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(); |
} |