Index: src/counters.cc |
diff --git a/src/counters.cc b/src/counters.cc |
index 811c0aa2e62038cc997a2fe1c0859b60fe02f7e2..db8a1237e958a4ca68fc08f6862d6c8bf3c9cb54 100644 |
--- a/src/counters.cc |
+++ b/src/counters.cc |
@@ -77,7 +77,7 @@ void* Histogram::CreateHistogram() const { |
// Start the timer. |
void HistogramTimer::Start() { |
- if (histogram_.Enabled()) { |
+ if (histogram_.Enabled() || FLAG_log_timer_events) { |
stop_time_ = 0; |
start_time_ = OS::Ticks(); |
} |
@@ -87,11 +87,15 @@ void HistogramTimer::Start() { |
void HistogramTimer::Stop() { |
if (histogram_.Enabled()) { |
stop_time_ = OS::Ticks(); |
- |
// Compute the delta between start and stop, in milliseconds. |
int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000; |
histogram_.AddSample(milliseconds); |
} |
+ if (FLAG_log_timer_events) { |
+ stop_time_ = OS::Ticks(); |
+ Isolate::Current()->logger()->TimerEvent( |
+ histogram_.name_, start_time_, stop_time_); |
+ } |
} |
} } // namespace v8::internal |