OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // --prof | 64 // --prof |
65 // Collect statistical profiling information (ticks), default is off. The | 65 // Collect statistical profiling information (ticks), default is off. The |
66 // tick profiler requires code events, so --prof implies --log-code. | 66 // tick profiler requires code events, so --prof implies --log-code. |
67 | 67 |
68 // Forward declarations. | 68 // Forward declarations. |
69 class Ticker; | 69 class Ticker; |
70 class Profiler; | 70 class Profiler; |
71 class Semaphore; | 71 class Semaphore; |
72 class SlidingStateWindow; | 72 class SlidingStateWindow; |
73 class LogMessageBuilder; | 73 class LogMessageBuilder; |
| 74 class CompressionHelper; |
74 | 75 |
75 #undef LOG | 76 #undef LOG |
76 #ifdef ENABLE_LOGGING_AND_PROFILING | 77 #ifdef ENABLE_LOGGING_AND_PROFILING |
77 #define LOG(Call) \ | 78 #define LOG(Call) \ |
78 do { \ | 79 do { \ |
79 if (v8::internal::Logger::IsEnabled()) \ | 80 if (v8::internal::Logger::IsEnabled()) \ |
80 v8::internal::Logger::Call; \ | 81 v8::internal::Logger::Call; \ |
81 } while (false) | 82 } while (false) |
82 #else | 83 #else |
83 #define LOG(Call) ((void) 0) | 84 #define LOG(Call) ((void) 0) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 static int GetLogLines(int from_pos, char* dest_buf, int max_size); | 250 static int GetLogLines(int from_pos, char* dest_buf, int max_size); |
250 | 251 |
251 // Logs all compiled functions found in the heap. | 252 // Logs all compiled functions found in the heap. |
252 static void LogCompiledFunctions(); | 253 static void LogCompiledFunctions(); |
253 | 254 |
254 private: | 255 private: |
255 | 256 |
256 // Profiler's sampling interval (in milliseconds). | 257 // Profiler's sampling interval (in milliseconds). |
257 static const int kSamplingIntervalMs = 1; | 258 static const int kSamplingIntervalMs = 1; |
258 | 259 |
| 260 // Size of window used for log records compression. |
| 261 static const int kCompressionWindowSize = 4; |
| 262 |
259 // Emits the profiler's first message. | 263 // Emits the profiler's first message. |
260 static void ProfilerBeginEvent(); | 264 static void ProfilerBeginEvent(); |
261 | 265 |
262 // Emits aliases for compressed messages. | 266 // Emits aliases for compressed messages. |
263 static void LogAliases(); | 267 static void LogAliases(); |
264 | 268 |
265 // Emits the source code of a regexp. Used by regexp events. | 269 // Emits the source code of a regexp. Used by regexp events. |
266 static void LogRegExpSource(Handle<JSRegExp> regexp); | 270 static void LogRegExpSource(Handle<JSRegExp> regexp); |
267 | 271 |
268 // Emits a profiler tick event. Used by the profiler thread. | 272 // Emits a profiler tick event. Used by the profiler thread. |
(...skipping 24 matching lines...) Expand all Loading... |
293 // Singleton bottom or default vm state. | 297 // Singleton bottom or default vm state. |
294 static VMState bottom_state_; | 298 static VMState bottom_state_; |
295 | 299 |
296 // SlidingStateWindow instance keeping a sliding window of the most | 300 // SlidingStateWindow instance keeping a sliding window of the most |
297 // recent VM states. | 301 // recent VM states. |
298 static SlidingStateWindow* sliding_state_window_; | 302 static SlidingStateWindow* sliding_state_window_; |
299 | 303 |
300 // An array of log events names. | 304 // An array of log events names. |
301 static const char** log_events_; | 305 static const char** log_events_; |
302 | 306 |
303 // Counter for repeated tick events. | 307 // An instance of helper created if log compression is enabled. |
304 static int tick_repeat_count_; | 308 static CompressionHelper* compression_helper_; |
305 | 309 |
306 // Internal implementation classes with access to | 310 // Internal implementation classes with access to |
307 // private members. | 311 // private members. |
| 312 friend class CompressionHelper; |
308 friend class EventLog; | 313 friend class EventLog; |
309 friend class TimeLog; | 314 friend class TimeLog; |
310 friend class Profiler; | 315 friend class Profiler; |
311 friend class SlidingStateWindow; | 316 friend class SlidingStateWindow; |
312 friend class VMState; | 317 friend class VMState; |
313 | 318 |
314 friend class LoggerTestHelper; | 319 friend class LoggerTestHelper; |
315 #else | 320 #else |
316 static bool is_enabled() { return false; } | 321 static bool is_enabled() { return false; } |
317 #endif | 322 #endif |
318 }; | 323 }; |
319 | 324 |
320 | 325 |
321 // Class that extracts stack trace, used for profiling. | 326 // Class that extracts stack trace, used for profiling. |
322 class StackTracer : public AllStatic { | 327 class StackTracer : public AllStatic { |
323 public: | 328 public: |
324 static void Trace(TickSample* sample); | 329 static void Trace(TickSample* sample); |
325 }; | 330 }; |
326 | 331 |
327 | 332 |
328 } } // namespace v8::internal | 333 } } // namespace v8::internal |
329 | 334 |
330 #endif // V8_LOG_H_ | 335 #endif // V8_LOG_H_ |
OLD | NEW |