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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 // Log an event reported from generated code | 259 // Log an event reported from generated code |
260 static void LogRuntime(Vector<const char> format, JSArray* args); | 260 static void LogRuntime(Vector<const char> format, JSArray* args); |
261 | 261 |
262 #ifdef ENABLE_LOGGING_AND_PROFILING | 262 #ifdef ENABLE_LOGGING_AND_PROFILING |
263 static StateTag state() { | 263 static StateTag state() { |
264 return current_state_ ? current_state_->state() : OTHER; | 264 return current_state_ ? current_state_->state() : OTHER; |
265 } | 265 } |
266 | 266 |
267 static bool is_logging() { | 267 static bool is_logging() { |
268 return is_logging_; | 268 return logging_nesting_ > 0; |
269 } | 269 } |
270 | 270 |
271 // Pause/Resume collection of profiling data. | 271 // Pause/Resume collection of profiling data. |
272 // When data collection is paused, CPU Tick events are discarded until | 272 // When data collection is paused, CPU Tick events are discarded until |
273 // data collection is Resumed. | 273 // data collection is Resumed. |
274 static void PauseProfiler(int flags, int tag); | 274 static void PauseProfiler(int flags, int tag); |
275 static void ResumeProfiler(int flags, int tag); | 275 static void ResumeProfiler(int flags, int tag); |
276 static int GetActiveProfilerModules(); | 276 static int GetActiveProfilerModules(); |
277 | 277 |
278 // If logging is performed into a memory buffer, allows to | 278 // If logging is performed into a memory buffer, allows to |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 static void LogCodeObject(Object* code_object); | 323 static void LogCodeObject(Object* code_object); |
324 | 324 |
325 // Emits a profiler tick event. Used by the profiler thread. | 325 // Emits a profiler tick event. Used by the profiler thread. |
326 static void TickEvent(TickSample* sample, bool overflow); | 326 static void TickEvent(TickSample* sample, bool overflow); |
327 | 327 |
328 static void ApiEvent(const char* name, ...); | 328 static void ApiEvent(const char* name, ...); |
329 | 329 |
330 // Logs a StringEvent regardless of whether FLAG_log is true. | 330 // Logs a StringEvent regardless of whether FLAG_log is true. |
331 static void UncheckedStringEvent(const char* name, const char* value); | 331 static void UncheckedStringEvent(const char* name, const char* value); |
332 | 332 |
| 333 // Logs an IntEvent regardless of whether FLAG_log is true. |
| 334 static void UncheckedIntEvent(const char* name, int value); |
| 335 |
333 // Stops logging and profiling in case of insufficient resources. | 336 // Stops logging and profiling in case of insufficient resources. |
334 static void StopLoggingAndProfiling(); | 337 static void StopLoggingAndProfiling(); |
335 | 338 |
336 // Returns whether profiler's sampler is active. | 339 // Returns whether profiler's sampler is active. |
337 static bool IsProfilerSamplerActive(); | 340 static bool IsProfilerSamplerActive(); |
338 | 341 |
339 // The sampler used by the profiler and the sliding state window. | 342 // The sampler used by the profiler and the sliding state window. |
340 static Ticker* ticker_; | 343 static Ticker* ticker_; |
341 | 344 |
342 // When the statistical profile is active, profiler_ | 345 // When the statistical profile is active, profiler_ |
(...skipping 22 matching lines...) Expand all Loading... |
365 friend class CompressionHelper; | 368 friend class CompressionHelper; |
366 friend class EventLog; | 369 friend class EventLog; |
367 friend class TimeLog; | 370 friend class TimeLog; |
368 friend class Profiler; | 371 friend class Profiler; |
369 friend class SlidingStateWindow; | 372 friend class SlidingStateWindow; |
370 friend class StackTracer; | 373 friend class StackTracer; |
371 friend class VMState; | 374 friend class VMState; |
372 | 375 |
373 friend class LoggerTestHelper; | 376 friend class LoggerTestHelper; |
374 | 377 |
375 static bool is_logging_; | 378 static int logging_nesting_; |
376 static int cpu_profiler_nesting_; | 379 static int cpu_profiler_nesting_; |
377 static int heap_profiler_nesting_; | 380 static int heap_profiler_nesting_; |
378 #else | 381 #else |
379 static bool is_logging() { return false; } | 382 static bool is_logging() { return false; } |
380 #endif | 383 #endif |
381 }; | 384 }; |
382 | 385 |
383 | 386 |
384 // Class that extracts stack trace, used for profiling. | 387 // Class that extracts stack trace, used for profiling. |
385 class StackTracer : public AllStatic { | 388 class StackTracer : public AllStatic { |
386 public: | 389 public: |
387 static void Trace(TickSample* sample); | 390 static void Trace(TickSample* sample); |
388 }; | 391 }; |
389 | 392 |
390 | 393 |
391 } } // namespace v8::internal | 394 } } // namespace v8::internal |
392 | 395 |
393 #endif // V8_LOG_H_ | 396 #endif // V8_LOG_H_ |
OLD | NEW |