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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 // Pause/Resume collection of profiling data. | 209 // Pause/Resume collection of profiling data. |
210 // When data collection is paused, Tick events are discarded until | 210 // When data collection is paused, Tick events are discarded until |
211 // data collection is Resumed. | 211 // data collection is Resumed. |
212 static bool IsProfilerPaused(); | 212 static bool IsProfilerPaused(); |
213 static void PauseProfiler(); | 213 static void PauseProfiler(); |
214 static void ResumeProfiler(); | 214 static void ResumeProfiler(); |
215 | 215 |
216 private: | 216 private: |
217 | 217 |
218 // Calculate the size of the code object to report for log events. This takes | |
219 // the layout of the code object into account. | |
220 static int CodeObjectSize(Code* code); | |
221 | |
222 // Emits the source code of a regexp. Used by regexp events. | 218 // Emits the source code of a regexp. Used by regexp events. |
223 static void LogRegExpSource(Handle<JSRegExp> regexp); | 219 static void LogRegExpSource(Handle<JSRegExp> regexp); |
224 | 220 |
225 // Emits a profiler tick event. Used by the profiler thread. | 221 // Emits a profiler tick event. Used by the profiler thread. |
226 static void TickEvent(TickSample* sample, bool overflow); | 222 static void TickEvent(TickSample* sample, bool overflow); |
227 | 223 |
228 static void ApiEvent(const char* name, ...); | 224 static void ApiEvent(const char* name, ...); |
229 | 225 |
230 // Logs a StringEvent regardless of whether FLAG_log is true. | 226 // Logs a StringEvent regardless of whether FLAG_log is true. |
231 static void UncheckedStringEvent(const char* name, const char* value); | 227 static void UncheckedStringEvent(const char* name, const char* value); |
(...skipping 29 matching lines...) Expand all Loading... |
261 static SlidingStateWindow* sliding_state_window_; | 257 static SlidingStateWindow* sliding_state_window_; |
262 | 258 |
263 // Internal implementation classes with access to | 259 // Internal implementation classes with access to |
264 // private members. | 260 // private members. |
265 friend class LogMessageBuilder; | 261 friend class LogMessageBuilder; |
266 friend class EventLog; | 262 friend class EventLog; |
267 friend class TimeLog; | 263 friend class TimeLog; |
268 friend class Profiler; | 264 friend class Profiler; |
269 friend class SlidingStateWindow; | 265 friend class SlidingStateWindow; |
270 friend class VMState; | 266 friend class VMState; |
| 267 #else |
| 268 static bool is_enabled() { return false; } |
271 #endif | 269 #endif |
272 }; | 270 }; |
273 | 271 |
274 | 272 |
275 // Class that extracts stack trace, used for profiling | 273 // Class that extracts stack trace, used for profiling |
276 class StackTracer BASE_EMBEDDED { | 274 class StackTracer BASE_EMBEDDED { |
277 public: | 275 public: |
278 explicit StackTracer(unsigned int low_stack_bound) | 276 explicit StackTracer(unsigned int low_stack_bound) |
279 : low_stack_bound_(low_stack_bound) { } | 277 : low_stack_bound_(low_stack_bound) { } |
280 void Trace(TickSample* sample); | 278 void Trace(TickSample* sample); |
281 private: | 279 private: |
282 // Maximum number of stack frames to capture | 280 // Maximum number of stack frames to capture |
283 static const int kMaxStackFrames = 5; | 281 static const int kMaxStackFrames = 5; |
284 | 282 |
285 unsigned int low_stack_bound_; | 283 unsigned int low_stack_bound_; |
286 }; | 284 }; |
287 | 285 |
288 | 286 |
289 } } // namespace v8::internal | 287 } } // namespace v8::internal |
290 | 288 |
291 #endif // V8_LOG_H_ | 289 #endif // V8_LOG_H_ |
OLD | NEW |