| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 145 | 145 | 
| 146 class JitLogger; | 146 class JitLogger; | 
| 147 class PerfBasicLogger; | 147 class PerfBasicLogger; | 
| 148 class LowLevelLogger; | 148 class LowLevelLogger; | 
| 149 class PerfJitLogger; | 149 class PerfJitLogger; | 
| 150 class Sampler; | 150 class Sampler; | 
| 151 | 151 | 
| 152 class Logger { | 152 class Logger { | 
| 153  public: | 153  public: | 
| 154   enum StartEnd { START = 0, END = 1 }; | 154   enum StartEnd { START = 0, END = 1 }; | 
|  | 155   enum Overhead { LOW = 0, NORMAL = 1, HIGH = 2 }; | 
| 155 | 156 | 
| 156 #define DECLARE_ENUM(enum_item, ignore) enum_item, | 157 #define DECLARE_ENUM(enum_item, ignore) enum_item, | 
| 157   enum LogEventsAndTags { | 158   enum LogEventsAndTags { | 
| 158     LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 159     LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) | 
| 159     NUMBER_OF_LOG_EVENTS | 160     NUMBER_OF_LOG_EVENTS | 
| 160   }; | 161   }; | 
| 161 #undef DECLARE_ENUM | 162 #undef DECLARE_ENUM | 
| 162 | 163 | 
| 163   // Acquires resources for logging if the right flags are set. | 164   // Acquires resources for logging if the right flags are set. | 
| 164   bool SetUp(Isolate* isolate); | 165   bool SetUp(Isolate* isolate); | 
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 296   void CurrentTimeEvent(); | 297   void CurrentTimeEvent(); | 
| 297 | 298 | 
| 298   void TimerEvent(StartEnd se, const char* name); | 299   void TimerEvent(StartEnd se, const char* name); | 
| 299 | 300 | 
| 300   static void EnterExternal(Isolate* isolate); | 301   static void EnterExternal(Isolate* isolate); | 
| 301   static void LeaveExternal(Isolate* isolate); | 302   static void LeaveExternal(Isolate* isolate); | 
| 302 | 303 | 
| 303   static void DefaultEventLoggerSentinel(const char* name, int event) {} | 304   static void DefaultEventLoggerSentinel(const char* name, int event) {} | 
| 304 | 305 | 
| 305   INLINE(static void CallEventLogger(Isolate* isolate, const char* name, | 306   INLINE(static void CallEventLogger(Isolate* isolate, const char* name, | 
| 306                                      StartEnd se, bool expose_to_api)); | 307                                      StartEnd se, Overhead overhead)); | 
| 307 | 308 | 
| 308   // ==== Events logged by --log-regexp ==== | 309   // ==== Events logged by --log-regexp ==== | 
| 309   // Regexp compilation and execution events. | 310   // Regexp compilation and execution events. | 
| 310 | 311 | 
| 311   void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 312   void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); | 
| 312 | 313 | 
| 313   bool is_logging() { | 314   bool is_logging() { | 
| 314     return is_logging_; | 315     return is_logging_; | 
| 315   } | 316   } | 
| 316 | 317 | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 415   // Guards against multiple calls to TearDown() that can happen in some tests. | 416   // Guards against multiple calls to TearDown() that can happen in some tests. | 
| 416   // 'true' between SetUp() and TearDown(). | 417   // 'true' between SetUp() and TearDown(). | 
| 417   bool is_initialized_; | 418   bool is_initialized_; | 
| 418 | 419 | 
| 419   base::ElapsedTimer timer_; | 420   base::ElapsedTimer timer_; | 
| 420 | 421 | 
| 421   friend class CpuProfiler; | 422   friend class CpuProfiler; | 
| 422 }; | 423 }; | 
| 423 | 424 | 
| 424 | 425 | 
| 425 #define TIMER_EVENTS_LIST(V)    \ | 426 #define TIMER_EVENTS_LIST(V)      \ | 
| 426   V(RecompileSynchronous, true) \ | 427   V(RecompileSynchronous, NORMAL) \ | 
| 427   V(RecompileConcurrent, true)  \ | 428   V(RecompileConcurrent, NORMAL)  \ | 
| 428   V(CompileFullCode, true)      \ | 429   V(CompileFullCode, NORMAL)      \ | 
| 429   V(Execute, true)              \ | 430   V(Execute, NORMAL)              \ | 
| 430   V(External, true)             \ | 431   V(External, NORMAL)             \ | 
| 431   V(IcMiss, false) | 432   V(IcMiss, HIGH) | 
| 432 | 433 | 
| 433 #define V(TimerName, expose)                                                  \ | 434 #define V(TimerName, TimerOverhead)                                           \ | 
| 434   class TimerEvent##TimerName : public AllStatic {                            \ | 435   class TimerEvent##TimerName : public AllStatic {                            \ | 
| 435    public:                                                                    \ | 436    public:                                                                    \ | 
| 436     static const char* name(void* unused = NULL) { return "V8." #TimerName; } \ | 437     static const char* name(void* unused = NULL) { return "V8." #TimerName; } \ | 
| 437     static bool expose_to_api() { return expose; }                            \ | 438     static Logger::Overhead overhead() { return Logger::TimerOverhead; }      \ | 
| 438   }; | 439   }; | 
| 439 TIMER_EVENTS_LIST(V) | 440 TIMER_EVENTS_LIST(V) | 
| 440 #undef V | 441 #undef V | 
| 441 | 442 | 
| 442 | 443 | 
| 443 template <class TimerEvent> | 444 template <class TimerEvent> | 
| 444 class TimerEventScope { | 445 class TimerEventScope { | 
| 445  public: | 446  public: | 
| 446   explicit TimerEventScope(Isolate* isolate) : isolate_(isolate) { | 447   explicit TimerEventScope(Isolate* isolate) : isolate_(isolate) { | 
| 447     LogTimerEvent(Logger::START); | 448     LogTimerEvent(Logger::START); | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 534                                  int length) = 0; | 535                                  int length) = 0; | 
| 535 | 536 | 
| 536   NameBuffer* name_buffer_; | 537   NameBuffer* name_buffer_; | 
| 537 }; | 538 }; | 
| 538 | 539 | 
| 539 | 540 | 
| 540 } }  // namespace v8::internal | 541 } }  // namespace v8::internal | 
| 541 | 542 | 
| 542 | 543 | 
| 543 #endif  // V8_LOG_H_ | 544 #endif  // V8_LOG_H_ | 
| OLD | NEW | 
|---|