OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_LOG_H_ | 5 #ifndef V8_LOG_H_ |
6 #define V8_LOG_H_ | 6 #define V8_LOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Collect statistical profiling information (ticks), default is off. The | 61 // Collect statistical profiling information (ticks), default is off. The |
62 // tick profiler requires code events, so --prof implies --log-code. | 62 // tick profiler requires code events, so --prof implies --log-code. |
63 | 63 |
64 // Forward declarations. | 64 // Forward declarations. |
65 class CodeEventListener; | 65 class CodeEventListener; |
66 class CpuProfiler; | 66 class CpuProfiler; |
67 class Isolate; | 67 class Isolate; |
68 class Log; | 68 class Log; |
69 class PositionsRecorder; | 69 class PositionsRecorder; |
70 class Profiler; | 70 class Profiler; |
| 71 class ProfilerListener; |
71 class Ticker; | 72 class Ticker; |
72 struct TickSample; | 73 struct TickSample; |
73 class RuntimeCallTimer; | 74 class RuntimeCallTimer; |
74 | 75 |
75 #undef LOG | 76 #undef LOG |
76 #define LOG(isolate, Call) \ | 77 #define LOG(isolate, Call) \ |
77 do { \ | 78 do { \ |
78 v8::internal::Logger* logger = (isolate)->logger(); \ | 79 v8::internal::Logger* logger = (isolate)->logger(); \ |
79 if (logger->is_logging()) logger->Call; \ | 80 if (logger->is_logging()) logger->Call; \ |
80 } while (false) | 81 } while (false) |
(...skipping 15 matching lines...) Expand all Loading... |
96 | 97 |
97 // Acquires resources for logging if the right flags are set. | 98 // Acquires resources for logging if the right flags are set. |
98 bool SetUp(Isolate* isolate); | 99 bool SetUp(Isolate* isolate); |
99 | 100 |
100 // Sets the current code event handler. | 101 // Sets the current code event handler. |
101 void SetCodeEventHandler(uint32_t options, | 102 void SetCodeEventHandler(uint32_t options, |
102 JitCodeEventHandler event_handler); | 103 JitCodeEventHandler event_handler); |
103 | 104 |
104 sampler::Sampler* sampler(); | 105 sampler::Sampler* sampler(); |
105 | 106 |
| 107 ProfilerListener* profiler_listener() { return profiler_listener_; } |
| 108 |
106 // Frees resources acquired in SetUp. | 109 // Frees resources acquired in SetUp. |
107 // When a temporary file is used for the log, returns its stream descriptor, | 110 // When a temporary file is used for the log, returns its stream descriptor, |
108 // leaving the file open. | 111 // leaving the file open. |
109 FILE* TearDown(); | 112 FILE* TearDown(); |
110 | 113 |
111 // Emits an event with a string value -> (name, value). | 114 // Emits an event with a string value -> (name, value). |
112 void StringEvent(const char* name, const char* value); | 115 void StringEvent(const char* name, const char* value); |
113 | 116 |
114 // Emits an event with an int value -> (name, value). | 117 // Emits an event with an int value -> (name, value). |
115 void IntEvent(const char* name, int value); | 118 void IntEvent(const char* name, int value); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 friend class Profiler; | 328 friend class Profiler; |
326 template <StateTag Tag> friend class VMState; | 329 template <StateTag Tag> friend class VMState; |
327 friend class LoggerTestHelper; | 330 friend class LoggerTestHelper; |
328 | 331 |
329 bool is_logging_; | 332 bool is_logging_; |
330 Log* log_; | 333 Log* log_; |
331 PerfBasicLogger* perf_basic_logger_; | 334 PerfBasicLogger* perf_basic_logger_; |
332 PerfJitLogger* perf_jit_logger_; | 335 PerfJitLogger* perf_jit_logger_; |
333 LowLevelLogger* ll_logger_; | 336 LowLevelLogger* ll_logger_; |
334 JitLogger* jit_logger_; | 337 JitLogger* jit_logger_; |
| 338 ProfilerListener* profiler_listener_; |
335 List<CodeEventListener*> listeners_; | 339 List<CodeEventListener*> listeners_; |
336 | 340 |
337 // Guards against multiple calls to TearDown() that can happen in some tests. | 341 // Guards against multiple calls to TearDown() that can happen in some tests. |
338 // 'true' between SetUp() and TearDown(). | 342 // 'true' between SetUp() and TearDown(). |
339 bool is_initialized_; | 343 bool is_initialized_; |
340 | 344 |
341 base::ElapsedTimer timer_; | 345 base::ElapsedTimer timer_; |
342 | 346 |
343 friend class CpuProfiler; | 347 friend class CpuProfiler; |
344 }; | 348 }; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 438 |
435 NameBuffer* name_buffer_; | 439 NameBuffer* name_buffer_; |
436 }; | 440 }; |
437 | 441 |
438 | 442 |
439 } // namespace internal | 443 } // namespace internal |
440 } // namespace v8 | 444 } // namespace v8 |
441 | 445 |
442 | 446 |
443 #endif // V8_LOG_H_ | 447 #endif // V8_LOG_H_ |
OLD | NEW |