Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: src/log.cc

Issue 12040075: Log event start and event end separately when using --log-timer-events. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log.h ('k') | src/vm-state-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/log.h ('k') | src/vm-state-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698