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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #define LOG_CODE_EVENT(isolate, Call) \ | 82 #define LOG_CODE_EVENT(isolate, Call) \ |
83 do { \ | 83 do { \ |
84 v8::internal::Logger* logger = (isolate)->logger(); \ | 84 v8::internal::Logger* logger = (isolate)->logger(); \ |
85 if (logger->is_logging_code_events()) logger->Call; \ | 85 if (logger->is_logging_code_events()) logger->Call; \ |
86 } while (false) | 86 } while (false) |
87 | 87 |
88 class JitLogger; | 88 class JitLogger; |
89 class PerfBasicLogger; | 89 class PerfBasicLogger; |
90 class LowLevelLogger; | 90 class LowLevelLogger; |
91 class PerfJitLogger; | 91 class PerfJitLogger; |
| 92 class ProfilerListener; |
92 | 93 |
93 class Logger : public CodeEventListener { | 94 class Logger : public CodeEventListener { |
94 public: | 95 public: |
95 enum StartEnd { START = 0, END = 1 }; | 96 enum StartEnd { START = 0, END = 1 }; |
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 |
| 105 // Sets up ProfilerListener. |
| 106 void SetUpProfilerListener(); |
| 107 |
104 sampler::Sampler* sampler(); | 108 sampler::Sampler* sampler(); |
105 | 109 |
| 110 ProfilerListener* profiler_listener() { return profiler_listener_; } |
| 111 |
106 // Frees resources acquired in SetUp. | 112 // Frees resources acquired in SetUp. |
107 // When a temporary file is used for the log, returns its stream descriptor, | 113 // When a temporary file is used for the log, returns its stream descriptor, |
108 // leaving the file open. | 114 // leaving the file open. |
109 FILE* TearDown(); | 115 FILE* TearDown(); |
110 | 116 |
111 // Emits an event with a string value -> (name, value). | 117 // Emits an event with a string value -> (name, value). |
112 void StringEvent(const char* name, const char* value); | 118 void StringEvent(const char* name, const char* value); |
113 | 119 |
114 // Emits an event with an int value -> (name, value). | 120 // Emits an event with an int value -> (name, value). |
115 void IntEvent(const char* name, int value); | 121 void IntEvent(const char* name, int value); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 friend class Profiler; | 331 friend class Profiler; |
326 template <StateTag Tag> friend class VMState; | 332 template <StateTag Tag> friend class VMState; |
327 friend class LoggerTestHelper; | 333 friend class LoggerTestHelper; |
328 | 334 |
329 bool is_logging_; | 335 bool is_logging_; |
330 Log* log_; | 336 Log* log_; |
331 PerfBasicLogger* perf_basic_logger_; | 337 PerfBasicLogger* perf_basic_logger_; |
332 PerfJitLogger* perf_jit_logger_; | 338 PerfJitLogger* perf_jit_logger_; |
333 LowLevelLogger* ll_logger_; | 339 LowLevelLogger* ll_logger_; |
334 JitLogger* jit_logger_; | 340 JitLogger* jit_logger_; |
| 341 ProfilerListener* profiler_listener_; |
335 List<CodeEventListener*> listeners_; | 342 List<CodeEventListener*> listeners_; |
336 | 343 |
337 // Guards against multiple calls to TearDown() that can happen in some tests. | 344 // Guards against multiple calls to TearDown() that can happen in some tests. |
338 // 'true' between SetUp() and TearDown(). | 345 // 'true' between SetUp() and TearDown(). |
339 bool is_initialized_; | 346 bool is_initialized_; |
340 | 347 |
341 base::ElapsedTimer timer_; | 348 base::ElapsedTimer timer_; |
342 | 349 |
343 friend class CpuProfiler; | 350 friend class CpuProfiler; |
344 }; | 351 }; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 441 |
435 NameBuffer* name_buffer_; | 442 NameBuffer* name_buffer_; |
436 }; | 443 }; |
437 | 444 |
438 | 445 |
439 } // namespace internal | 446 } // namespace internal |
440 } // namespace v8 | 447 } // namespace v8 |
441 | 448 |
442 | 449 |
443 #endif // V8_LOG_H_ | 450 #endif // V8_LOG_H_ |
OLD | NEW |