def add_custom(type, elapsed_ms, page)
TimerStruct::Custom.new(type, elapsed_ms, page, self).tap do |timer|
timer[:parent_timing_id] = self[:id]
self[:custom_timings][type] ||= []
self[:custom_timings][type].push(timer)
self[:custom_timing_stats][type] ||= {:count => 0, :duration => 0.0}
self[:custom_timing_stats][type][:count] += 1
self[:custom_timing_stats][type][:duration] += elapsed_ms
page[:custom_timing_stats][type] ||= {:count => 0, :duration => 0.0}
page[:custom_timing_stats][type][:count] += 1
page[:custom_timing_stats][type][:duration] += elapsed_ms
end
end