| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 // Acquires resources for logging if the right flags are set. | 155 // Acquires resources for logging if the right flags are set. |
| 156 static bool Setup(); | 156 static bool Setup(); |
| 157 | 157 |
| 158 // Frees resources acquired in Setup. | 158 // Frees resources acquired in Setup. |
| 159 static void TearDown(); | 159 static void TearDown(); |
| 160 | 160 |
| 161 // Enable the computation of a sliding window of states. | 161 // Enable the computation of a sliding window of states. |
| 162 static void EnableSlidingStateWindow(); | 162 static void EnableSlidingStateWindow(); |
| 163 | 163 |
| 164 // Write a raw string to the log to be used as a preamble. | |
| 165 // No check is made that the 'preamble' is actually at the beginning | |
| 166 // of the log. The preample is used to write code events saved in the | |
| 167 // snapshot. | |
| 168 static void Preamble(const char* content); | |
| 169 | |
| 170 // Emits an event with a string value -> (name, value). | 164 // Emits an event with a string value -> (name, value). |
| 171 static void StringEvent(const char* name, const char* value); | 165 static void StringEvent(const char* name, const char* value); |
| 172 | 166 |
| 173 // Emits an event with an int value -> (name, value). | 167 // Emits an event with an int value -> (name, value). |
| 174 static void IntEvent(const char* name, int value); | 168 static void IntEvent(const char* name, int value); |
| 175 | 169 |
| 176 // Emits an event with an handle value -> (name, location). | 170 // Emits an event with an handle value -> (name, location). |
| 177 static void HandleEvent(const char* name, Object** location); | 171 static void HandleEvent(const char* name, Object** location); |
| 178 | 172 |
| 179 // Emits memory management events for C allocated structures. | 173 // Emits memory management events for C allocated structures. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 return current_state_ ? current_state_->state() : OTHER; | 264 return current_state_ ? current_state_->state() : OTHER; |
| 271 } | 265 } |
| 272 | 266 |
| 273 static bool is_logging() { | 267 static bool is_logging() { |
| 274 return is_logging_; | 268 return is_logging_; |
| 275 } | 269 } |
| 276 | 270 |
| 277 // Pause/Resume collection of profiling data. | 271 // Pause/Resume collection of profiling data. |
| 278 // When data collection is paused, CPU Tick events are discarded until | 272 // When data collection is paused, CPU Tick events are discarded until |
| 279 // data collection is Resumed. | 273 // data collection is Resumed. |
| 280 static void PauseProfiler(int flags); | 274 static void PauseProfiler(int flags, int tag); |
| 281 static void ResumeProfiler(int flags); | 275 static void ResumeProfiler(int flags, int tag); |
| 282 static int GetActiveProfilerModules(); | 276 static int GetActiveProfilerModules(); |
| 283 | 277 |
| 284 // If logging is performed into a memory buffer, allows to | 278 // If logging is performed into a memory buffer, allows to |
| 285 // retrieve previously written messages. See v8.h. | 279 // retrieve previously written messages. See v8.h. |
| 286 static int GetLogLines(int from_pos, char* dest_buf, int max_size); | 280 static int GetLogLines(int from_pos, char* dest_buf, int max_size); |
| 287 | 281 |
| 288 // Logs all compiled functions found in the heap. | 282 // Logs all compiled functions found in the heap. |
| 289 static void LogCompiledFunctions(); | 283 static void LogCompiledFunctions(); |
| 290 // Logs all compiled JSFunction objects found in the heap. | 284 // Logs all compiled JSFunction objects found in the heap. |
| 291 static void LogFunctionObjects(); | 285 static void LogFunctionObjects(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 friend class EventLog; | 366 friend class EventLog; |
| 373 friend class TimeLog; | 367 friend class TimeLog; |
| 374 friend class Profiler; | 368 friend class Profiler; |
| 375 friend class SlidingStateWindow; | 369 friend class SlidingStateWindow; |
| 376 friend class StackTracer; | 370 friend class StackTracer; |
| 377 friend class VMState; | 371 friend class VMState; |
| 378 | 372 |
| 379 friend class LoggerTestHelper; | 373 friend class LoggerTestHelper; |
| 380 | 374 |
| 381 static bool is_logging_; | 375 static bool is_logging_; |
| 376 static int cpu_profiler_nesting_; |
| 377 static int heap_profiler_nesting_; |
| 382 #else | 378 #else |
| 383 static bool is_logging() { return false; } | 379 static bool is_logging() { return false; } |
| 384 #endif | 380 #endif |
| 385 }; | 381 }; |
| 386 | 382 |
| 387 | 383 |
| 388 // Class that extracts stack trace, used for profiling. | 384 // Class that extracts stack trace, used for profiling. |
| 389 class StackTracer : public AllStatic { | 385 class StackTracer : public AllStatic { |
| 390 public: | 386 public: |
| 391 static void Trace(TickSample* sample); | 387 static void Trace(TickSample* sample); |
| 392 }; | 388 }; |
| 393 | 389 |
| 394 | 390 |
| 395 } } // namespace v8::internal | 391 } } // namespace v8::internal |
| 396 | 392 |
| 397 #endif // V8_LOG_H_ | 393 #endif // V8_LOG_H_ |
| OLD | NEW |