Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index efbb8f7f57f7150efda8615b54f9cdf2922b9692..4a53db4d8dd6295fdb2a71bbfaf14a5ad45dd277 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -633,46 +633,30 @@ void Logger::SharedLibraryEvent(const wchar_t* library_path, |
} |
-void Logger::TimerEvent(const char* name, int64_t start, int64_t end) { |
+void Logger::TimerEvent(StartEnd se, const char* name) { |
if (!log_->IsEnabled()) return; |
ASSERT(FLAG_log_internal_timer_events); |
LogMessageBuilder msg(this); |
- int since_epoch = static_cast<int>(start - epoch_); |
- int pause_time = static_cast<int>(end - start); |
- msg.Append("timer-event,\"%s\",%ld,%ld\n", name, since_epoch, pause_time); |
+ int since_epoch = static_cast<int>(OS::Ticks() - epoch_); |
+ const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n" |
+ : "timer-event-end,\"%s\",%ld\n"; |
+ msg.Append(format, name, since_epoch); |
msg.WriteToLogFile(); |
} |
-void Logger::ExternalSwitch(StateTag old_tag, StateTag new_tag) { |
- if (old_tag != EXTERNAL && new_tag == EXTERNAL) { |
- enter_external_ = OS::Ticks(); |
- } |
- if (old_tag == EXTERNAL && new_tag != EXTERNAL && enter_external_ != 0) { |
- TimerEvent("V8.External", enter_external_, OS::Ticks()); |
- enter_external_ = 0; |
- } |
-} |
- |
- |
void Logger::EnterExternal() { |
- LOGGER->enter_external_ = OS::Ticks(); |
+ LOG(ISOLATE, TimerEvent(START, TimerEventScope::v8_external)); |
} |
void Logger::LeaveExternal() { |
- if (enter_external_ == 0) return; |
- Logger* logger = LOGGER; |
- logger->TimerEvent("V8.External", enter_external_, OS::Ticks()); |
- logger->enter_external_ = 0; |
+ LOG(ISOLATE, TimerEvent(END, TimerEventScope::v8_external)); |
} |
-int64_t Logger::enter_external_ = 0; |
- |
- |
-void Logger::TimerEventScope::LogTimerEvent() { |
- LOG(isolate_, TimerEvent(name_, start_, OS::Ticks())); |
+void Logger::TimerEventScope::LogTimerEvent(StartEnd se) { |
+ LOG(isolate_, TimerEvent(se, name_)); |
} |
@@ -683,6 +667,7 @@ const char* Logger::TimerEventScope::v8_recompile_parallel = |
const char* Logger::TimerEventScope::v8_compile_full_code = |
"V8.CompileFullCode"; |
const char* Logger::TimerEventScope::v8_execute = "V8.Execute"; |
+const char* Logger::TimerEventScope::v8_external = "V8.External"; |
void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { |