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

Unified Diff: src/log.cc

Issue 123012: Implement tick events compression in a log file. (Closed)
Patch Set: Created 11 years, 6 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/log-utils.h » ('j') | src/log-utils.cc » ('J')
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 ee1ebb05fdc3d1633d5aaa8508b78ed292a84687..2a8c455a24b2686515ad9226b9a54e62b6587da3 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -303,6 +303,7 @@ VMState* Logger::current_state_ = NULL;
VMState Logger::bottom_state_(EXTERNAL);
SlidingStateWindow* Logger::sliding_state_window_ = NULL;
const char** Logger::log_events_ = NULL;
+int Logger::tick_repeat_count_ = 0;
#define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name,
const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
@@ -848,6 +849,28 @@ void Logger::TickEvent(TickSample* sample, bool overflow) {
msg.Append(",0x%" V8PRIxPTR, sample->stack[i]);
}
}
+ // In case if log compression is disabled, the flow is straightforward,
+ // because both StoreInCompressor and RetrieveCompressedPrevious do nothing
+ // and just return 'true'. Otherwise, to perform compression of repeated
+ // tick events, instead of the current event, the previous one is written.
+ if (!msg.StoreInCompressor()) {
+ // Current message repeats the previous one, don't write it.
+ ++tick_repeat_count_;
Søren Thygesen Gjesse 2009/06/11 11:13:56 Maybe we want to report something once in a while
Mikhail Naganov 2009/06/11 14:07:12 I think this is not needed. Overflow of a counter
+ return;
+ } else {
+ bool has_previous_message;
+ if (tick_repeat_count_ > 0) {
+ EmbeddedVector<char, 20> prefix;
+ OS::SNPrintF(prefix, "%s,%d,",
+ log_events_[REPEAT_META_EVENT],
+ tick_repeat_count_ + 1);
+ tick_repeat_count_ = 0;
+ has_previous_message = msg.RetrieveCompressedPrevious(prefix.start());
+ } else {
+ has_previous_message = msg.RetrieveCompressedPrevious();
+ }
+ if (!has_previous_message) return;
+ }
msg.Append('\n');
msg.WriteToLogFile();
}
« no previous file with comments | « src/log.h ('k') | src/log-utils.h » ('j') | src/log-utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698