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" |
11 #include "src/base/compiler-specific.h" | 11 #include "src/base/compiler-specific.h" |
12 #include "src/base/platform/elapsed-timer.h" | 12 #include "src/base/platform/elapsed-timer.h" |
13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
14 #include "src/code-events.h" | 14 #include "src/code-events.h" |
15 #include "src/isolate.h" | 15 #include "src/isolate.h" |
16 #include "src/objects.h" | 16 #include "src/objects.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 | 19 |
20 namespace base { | 20 struct TickSample; |
21 class Semaphore; | |
22 } | |
23 | 21 |
24 namespace sampler { | 22 namespace sampler { |
25 class Sampler; | 23 class Sampler; |
26 } | 24 } |
27 | 25 |
28 namespace internal { | 26 namespace internal { |
29 | 27 |
30 // Logger is used for collecting logging information from V8 during | 28 // Logger is used for collecting logging information from V8 during |
31 // execution. The result is dumped to a file. | 29 // execution. The result is dumped to a file. |
32 // | 30 // |
(...skipping 27 matching lines...) Expand all Loading... | |
60 // --prof | 58 // --prof |
61 // Collect statistical profiling information (ticks), default is off. The | 59 // Collect statistical profiling information (ticks), default is off. The |
62 // tick profiler requires code events, so --prof implies --log-code. | 60 // tick profiler requires code events, so --prof implies --log-code. |
63 | 61 |
64 // Forward declarations. | 62 // Forward declarations. |
65 class CodeEventListener; | 63 class CodeEventListener; |
66 class CpuProfiler; | 64 class CpuProfiler; |
67 class Isolate; | 65 class Isolate; |
68 class Log; | 66 class Log; |
69 class Profiler; | 67 class Profiler; |
68 class ProfilerListener; | |
69 class RuntimeCallTimer; | |
70 class Ticker; | 70 class Ticker; |
71 class RuntimeCallTimer; | |
72 struct TickSample; | |
73 | 71 |
74 #undef LOG | 72 #undef LOG |
75 #define LOG(isolate, Call) \ | 73 #define LOG(isolate, Call) \ |
76 do { \ | 74 do { \ |
77 v8::internal::Logger* logger = (isolate)->logger(); \ | 75 v8::internal::Logger* logger = (isolate)->logger(); \ |
78 if (logger->is_logging()) logger->Call; \ | 76 if (logger->is_logging()) logger->Call; \ |
79 } while (false) | 77 } while (false) |
80 | 78 |
81 #define LOG_CODE_EVENT(isolate, Call) \ | 79 #define LOG_CODE_EVENT(isolate, Call) \ |
82 do { \ | 80 do { \ |
83 v8::internal::Logger* logger = (isolate)->logger(); \ | 81 v8::internal::Logger* logger = (isolate)->logger(); \ |
84 if (logger->is_logging_code_events()) logger->Call; \ | 82 if (logger->is_logging_code_events()) logger->Call; \ |
85 } while (false) | 83 } while (false) |
86 | 84 |
87 class JitLogger; | 85 class JitLogger; |
88 class PerfBasicLogger; | 86 class PerfBasicLogger; |
89 class LowLevelLogger; | 87 class LowLevelLogger; |
90 class PerfJitLogger; | 88 class PerfJitLogger; |
Yang
2016/07/08 06:05:22
Let's also move these forward-declarations to the
alph
2016/07/08 21:45:43
Done.
| |
91 class ProfilerListener; | |
92 | 89 |
93 class Logger : public CodeEventListener { | 90 class Logger : public CodeEventListener { |
94 public: | 91 public: |
95 enum StartEnd { START = 0, END = 1 }; | 92 enum StartEnd { START = 0, END = 1 }; |
96 | 93 |
97 // Acquires resources for logging if the right flags are set. | 94 // Acquires resources for logging if the right flags are set. |
98 bool SetUp(Isolate* isolate); | 95 bool SetUp(Isolate* isolate); |
99 | 96 |
100 // Sets the current code event handler. | 97 // Sets the current code event handler. |
101 void SetCodeEventHandler(uint32_t options, | 98 void SetCodeEventHandler(uint32_t options, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 | 420 |
424 NameBuffer* name_buffer_; | 421 NameBuffer* name_buffer_; |
425 }; | 422 }; |
426 | 423 |
427 | 424 |
428 } // namespace internal | 425 } // namespace internal |
429 } // namespace v8 | 426 } // namespace v8 |
430 | 427 |
431 | 428 |
432 #endif // V8_LOG_H_ | 429 #endif // V8_LOG_H_ |
OLD | NEW |