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 | |
108 // Tear down ProfilerListener if it has no observer. | |
alph
2016/06/19 03:05:41
no observers.
lpy
2016/06/20 17:16:55
Done.
| |
109 void TearDownProfilerListener(); | |
110 | |
104 sampler::Sampler* sampler(); | 111 sampler::Sampler* sampler(); |
105 | 112 |
113 ProfilerListener* profiler_listener() { return profiler_listener_.get(); } | |
114 | |
106 // Frees resources acquired in SetUp. | 115 // Frees resources acquired in SetUp. |
107 // When a temporary file is used for the log, returns its stream descriptor, | 116 // When a temporary file is used for the log, returns its stream descriptor, |
108 // leaving the file open. | 117 // leaving the file open. |
109 FILE* TearDown(); | 118 FILE* TearDown(); |
110 | 119 |
111 // Emits an event with a string value -> (name, value). | 120 // Emits an event with a string value -> (name, value). |
112 void StringEvent(const char* name, const char* value); | 121 void StringEvent(const char* name, const char* value); |
113 | 122 |
114 // Emits an event with an int value -> (name, value). | 123 // Emits an event with an int value -> (name, value). |
115 void IntEvent(const char* name, int value); | 124 void IntEvent(const char* name, int value); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 friend class Profiler; | 334 friend class Profiler; |
326 template <StateTag Tag> friend class VMState; | 335 template <StateTag Tag> friend class VMState; |
327 friend class LoggerTestHelper; | 336 friend class LoggerTestHelper; |
328 | 337 |
329 bool is_logging_; | 338 bool is_logging_; |
330 Log* log_; | 339 Log* log_; |
331 PerfBasicLogger* perf_basic_logger_; | 340 PerfBasicLogger* perf_basic_logger_; |
332 PerfJitLogger* perf_jit_logger_; | 341 PerfJitLogger* perf_jit_logger_; |
333 LowLevelLogger* ll_logger_; | 342 LowLevelLogger* ll_logger_; |
334 JitLogger* jit_logger_; | 343 JitLogger* jit_logger_; |
344 std::unique_ptr<ProfilerListener> profiler_listener_; | |
alph
2016/06/19 03:05:41
thank you!
lpy
2016/06/20 17:16:55
\o/
| |
335 List<CodeEventListener*> listeners_; | 345 List<CodeEventListener*> listeners_; |
336 | 346 |
337 // Guards against multiple calls to TearDown() that can happen in some tests. | 347 // Guards against multiple calls to TearDown() that can happen in some tests. |
338 // 'true' between SetUp() and TearDown(). | 348 // 'true' between SetUp() and TearDown(). |
339 bool is_initialized_; | 349 bool is_initialized_; |
340 | 350 |
341 base::ElapsedTimer timer_; | 351 base::ElapsedTimer timer_; |
342 | 352 |
343 friend class CpuProfiler; | 353 friend class CpuProfiler; |
344 }; | 354 }; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 | 444 |
435 NameBuffer* name_buffer_; | 445 NameBuffer* name_buffer_; |
436 }; | 446 }; |
437 | 447 |
438 | 448 |
439 } // namespace internal | 449 } // namespace internal |
440 } // namespace v8 | 450 } // namespace v8 |
441 | 451 |
442 | 452 |
443 #endif // V8_LOG_H_ | 453 #endif // V8_LOG_H_ |
OLD | NEW |