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

Unified Diff: src/log.cc

Issue 20220: Fixing a few bugs to make the --log-state-change option work. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
===================================================================
--- src/log.cc (revision 1246)
+++ src/log.cc (working copy)
@@ -226,7 +226,7 @@
// Register to get ticks.
Logger::ticker_->SetProfiler(this);
- LOG(StringEvent("profiler", "begin"));
+ LOG(UncheckedStringEvent("profiler", "begin"));
}
@@ -245,7 +245,7 @@
Insert(&sample);
Join();
- LOG(StringEvent("profiler", "end"));
+ LOG(UncheckedStringEvent("profiler", "end"));
}
@@ -282,11 +282,18 @@
void Logger::StringEvent(const char* name, const char* value) {
#ifdef ENABLE_LOGGING_AND_PROFILING
- if (logfile_ == NULL || !FLAG_log) return;
+ if (FLAG_log) UncheckedStringEvent(name, value);
+#endif
+}
+
+
+#ifdef ENABLE_LOGGING_AND_PROFILING
+void Logger::UncheckedStringEvent(const char* name, const char* value) {
+ if (logfile_ == NULL) return;
ScopedLock sl(mutex_);
fprintf(logfile_, "%s,\"%s\"\n", name, value);
+}
#endif
-}
void Logger::IntEvent(const char* name, int value) {
@@ -808,7 +815,7 @@
bool open_log_file = FLAG_log || FLAG_log_api || FLAG_log_code
|| FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
- || FLAG_log_regexp;
+ || FLAG_log_regexp || FLAG_log_state_changes;
// If we're logging anything, we need to open the log file.
if (open_log_file) {
@@ -931,6 +938,8 @@
#ifdef ENABLE_LOGGING_AND_PROFILING
static const char* StateToString(StateTag state) {
switch (state) {
+ case JS:
+ return "JS";
case GC:
return "GC";
case COMPILER:
@@ -949,9 +958,9 @@
Logger::current_state_ = this;
if (FLAG_log_state_changes) {
- LOG(StringEvent("Entering", StateToString(state_)));
+ LOG(UncheckedStringEvent("Entering", StateToString(state_)));
if (previous_) {
- LOG(StringEvent("From", StateToString(previous_->state_)));
+ LOG(UncheckedStringEvent("From", StateToString(previous_->state_)));
}
}
}
@@ -961,9 +970,9 @@
Logger::current_state_ = previous_;
if (FLAG_log_state_changes) {
- LOG(StringEvent("Leaving", StateToString(state_)));
+ LOG(UncheckedStringEvent("Leaving", StateToString(state_)));
if (previous_) {
- LOG(StringEvent("To", StateToString(previous_->state_)));
+ LOG(UncheckedStringEvent("To", StateToString(previous_->state_)));
}
}
}
« no previous file with comments | « src/log.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698