OLD | NEW |
---|---|
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 | 296 |
297 // | 297 // |
298 // Logger class implementation. | 298 // Logger class implementation. |
299 // | 299 // |
300 Ticker* Logger::ticker_ = NULL; | 300 Ticker* Logger::ticker_ = NULL; |
301 Profiler* Logger::profiler_ = NULL; | 301 Profiler* Logger::profiler_ = NULL; |
302 VMState* Logger::current_state_ = NULL; | 302 VMState* Logger::current_state_ = NULL; |
303 VMState Logger::bottom_state_(EXTERNAL); | 303 VMState Logger::bottom_state_(EXTERNAL); |
304 SlidingStateWindow* Logger::sliding_state_window_ = NULL; | 304 SlidingStateWindow* Logger::sliding_state_window_ = NULL; |
305 const char** Logger::log_events_ = NULL; | 305 const char** Logger::log_events_ = NULL; |
306 int Logger::tick_repeat_count_ = 0; | |
306 | 307 |
307 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, | 308 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name, |
308 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 309 const char* kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
309 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) | 310 LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT) |
310 }; | 311 }; |
311 #undef DECLARE_LONG_EVENT | 312 #undef DECLARE_LONG_EVENT |
312 | 313 |
313 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, | 314 #define DECLARE_SHORT_EVENT(ignore1, ignore2, short_name) short_name, |
314 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 315 const char* kCompressedLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
315 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) | 316 LOG_EVENTS_AND_TAGS_LIST(DECLARE_SHORT_EVENT) |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
841 prev_ptr = ptr; | 842 prev_ptr = ptr; |
842 // To avoid printing negative offsets in an unsigned form, | 843 // To avoid printing negative offsets in an unsigned form, |
843 // we are printing an absolute value with a sign. | 844 // we are printing an absolute value with a sign. |
844 const char sign = delta >= 0 ? '+' : '-'; | 845 const char sign = delta >= 0 ? '+' : '-'; |
845 if (sign == '-') { delta = -delta; } | 846 if (sign == '-') { delta = -delta; } |
846 msg.Append(",%c0x%" V8PRIxPTR, sign, delta); | 847 msg.Append(",%c0x%" V8PRIxPTR, sign, delta); |
847 } else { | 848 } else { |
848 msg.Append(",0x%" V8PRIxPTR, sample->stack[i]); | 849 msg.Append(",0x%" V8PRIxPTR, sample->stack[i]); |
849 } | 850 } |
850 } | 851 } |
852 // In case if log compression is disabled, the flow is straightforward, | |
853 // because both StoreInCompressor and RetrieveCompressedPrevious do nothing | |
854 // and just return 'true'. Otherwise, to perform compression of repeated | |
855 // tick events, instead of the current event, the previous one is written. | |
856 if (!msg.StoreInCompressor()) { | |
857 // Current message repeats the previous one, don't write it. | |
858 ++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
| |
859 return; | |
860 } else { | |
861 bool has_previous_message; | |
862 if (tick_repeat_count_ > 0) { | |
863 EmbeddedVector<char, 20> prefix; | |
864 OS::SNPrintF(prefix, "%s,%d,", | |
865 log_events_[REPEAT_META_EVENT], | |
866 tick_repeat_count_ + 1); | |
867 tick_repeat_count_ = 0; | |
868 has_previous_message = msg.RetrieveCompressedPrevious(prefix.start()); | |
869 } else { | |
870 has_previous_message = msg.RetrieveCompressedPrevious(); | |
871 } | |
872 if (!has_previous_message) return; | |
873 } | |
851 msg.Append('\n'); | 874 msg.Append('\n'); |
852 msg.WriteToLogFile(); | 875 msg.WriteToLogFile(); |
853 } | 876 } |
854 | 877 |
855 | 878 |
856 bool Logger::IsProfilerPaused() { | 879 bool Logger::IsProfilerPaused() { |
857 return profiler_->paused(); | 880 return profiler_->paused(); |
858 } | 881 } |
859 | 882 |
860 | 883 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1188 } else if (previous_->state_ == EXTERNAL) { | 1211 } else if (previous_->state_ == EXTERNAL) { |
1189 // We are leaving V8. | 1212 // We are leaving V8. |
1190 Heap::Protect(); | 1213 Heap::Protect(); |
1191 } | 1214 } |
1192 } | 1215 } |
1193 #endif | 1216 #endif |
1194 } | 1217 } |
1195 #endif | 1218 #endif |
1196 | 1219 |
1197 } } // namespace v8::internal | 1220 } } // namespace v8::internal |
OLD | NEW |