OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #ifdef ENABLE_LOGGING_AND_PROFILING | 80 #ifdef ENABLE_LOGGING_AND_PROFILING |
81 #define LOG(Call) \ | 81 #define LOG(Call) \ |
82 do { \ | 82 do { \ |
83 if (v8::internal::Logger::is_logging()) \ | 83 if (v8::internal::Logger::is_logging()) \ |
84 v8::internal::Logger::Call; \ | 84 v8::internal::Logger::Call; \ |
85 } while (false) | 85 } while (false) |
86 #else | 86 #else |
87 #define LOG(Call) ((void) 0) | 87 #define LOG(Call) ((void) 0) |
88 #endif | 88 #endif |
89 | 89 |
90 | |
91 class VMState BASE_EMBEDDED { | 90 class VMState BASE_EMBEDDED { |
92 #ifdef ENABLE_LOGGING_AND_PROFILING | 91 #ifdef ENABLE_LOGGING_AND_PROFILING |
93 public: | 92 public: |
94 inline VMState(StateTag state); | 93 inline VMState(StateTag state); |
95 inline ~VMState(); | 94 inline ~VMState(); |
96 | 95 |
97 StateTag state() { return state_; } | 96 StateTag state() { return state_; } |
98 Address external_callback() { return external_callback_; } | 97 Address external_callback() { return external_callback_; } |
99 void set_external_callback(Address external_callback) { | 98 void set_external_callback(Address external_callback) { |
100 external_callback_ = external_callback; | 99 external_callback_ = external_callback; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 friend class Profiler; | 370 friend class Profiler; |
372 friend class SlidingStateWindow; | 371 friend class SlidingStateWindow; |
373 friend class StackTracer; | 372 friend class StackTracer; |
374 friend class VMState; | 373 friend class VMState; |
375 | 374 |
376 friend class LoggerTestHelper; | 375 friend class LoggerTestHelper; |
377 | 376 |
378 static int logging_nesting_; | 377 static int logging_nesting_; |
379 static int cpu_profiler_nesting_; | 378 static int cpu_profiler_nesting_; |
380 static int heap_profiler_nesting_; | 379 static int heap_profiler_nesting_; |
| 380 |
| 381 friend class CpuProfiler; |
381 #else | 382 #else |
382 static bool is_logging() { return false; } | 383 static bool is_logging() { return false; } |
383 #endif | 384 #endif |
384 }; | 385 }; |
385 | 386 |
386 | 387 |
387 // Class that extracts stack trace, used for profiling. | 388 // Class that extracts stack trace, used for profiling. |
388 class StackTracer : public AllStatic { | 389 class StackTracer : public AllStatic { |
389 public: | 390 public: |
390 static void Trace(TickSample* sample); | 391 static void Trace(TickSample* sample); |
391 }; | 392 }; |
392 | 393 |
393 | 394 |
| 395 #ifdef ENABLE_CPP_PROFILES_PROCESSOR |
| 396 |
| 397 class Ticker: public Sampler { |
| 398 public: |
| 399 explicit Ticker(int interval): |
| 400 Sampler(interval, FLAG_prof) {} |
| 401 |
| 402 void SampleStack(TickSample* sample) { |
| 403 StackTracer::Trace(sample); |
| 404 } |
| 405 void Tick(TickSample* sample) { } |
| 406 void SetWindow(SlidingStateWindow* window) { } |
| 407 void ClearWindow() { } |
| 408 void SetProfiler(Profiler* profiler) { } |
| 409 void ClearProfiler() { } |
| 410 }; |
| 411 |
| 412 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
| 413 |
394 } } // namespace v8::internal | 414 } } // namespace v8::internal |
395 | 415 |
| 416 |
396 #endif // V8_LOG_H_ | 417 #endif // V8_LOG_H_ |
OLD | NEW |