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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 static void LogRegExpSource(Handle<JSRegExp> regexp); | 223 static void LogRegExpSource(Handle<JSRegExp> regexp); |
224 | 224 |
225 // Emits a profiler tick event. Used by the profiler thread. | 225 // Emits a profiler tick event. Used by the profiler thread. |
226 static void TickEvent(TickSample* sample, bool overflow); | 226 static void TickEvent(TickSample* sample, bool overflow); |
227 | 227 |
228 static void ApiEvent(const char* name, ...); | 228 static void ApiEvent(const char* name, ...); |
229 | 229 |
230 // Logs a StringEvent regardless of whether FLAG_log is true. | 230 // Logs a StringEvent regardless of whether FLAG_log is true. |
231 static void UncheckedStringEvent(const char* name, const char* value); | 231 static void UncheckedStringEvent(const char* name, const char* value); |
232 | 232 |
| 233 // Returns whether profiler's sampler is active. |
| 234 static bool IsProfilerSamplerActive(); |
| 235 |
233 // The sampler used by the profiler and the sliding state window. | 236 // The sampler used by the profiler and the sliding state window. |
234 static Ticker* ticker_; | 237 static Ticker* ticker_; |
235 | 238 |
236 // When the statistical profile is active, profiler_ | 239 // When the statistical profile is active, profiler_ |
237 // points to a Profiler, that handles collection | 240 // points to a Profiler, that handles collection |
238 // of samples. | 241 // of samples. |
239 static Profiler* profiler_; | 242 static Profiler* profiler_; |
240 | 243 |
241 // A stack of VM states. | 244 // A stack of VM states. |
242 static VMState* current_state_; | 245 static VMState* current_state_; |
243 | 246 |
244 // Singleton bottom or default vm state. | 247 // Singleton bottom or default vm state. |
245 static VMState bottom_state_; | 248 static VMState bottom_state_; |
246 | 249 |
247 // SlidingStateWindow instance keeping a sliding window of the most | 250 // SlidingStateWindow instance keeping a sliding window of the most |
248 // recent VM states. | 251 // recent VM states. |
249 static SlidingStateWindow* sliding_state_window_; | 252 static SlidingStateWindow* sliding_state_window_; |
250 | 253 |
251 // Internal implementation classes with access to | 254 // Internal implementation classes with access to |
252 // private members. | 255 // private members. |
253 friend class EventLog; | 256 friend class EventLog; |
254 friend class TimeLog; | 257 friend class TimeLog; |
255 friend class Profiler; | 258 friend class Profiler; |
256 friend class SlidingStateWindow; | 259 friend class SlidingStateWindow; |
257 friend class VMState; | 260 friend class VMState; |
| 261 |
| 262 friend class LoggerTestHelper; |
258 #else | 263 #else |
259 static bool is_enabled() { return false; } | 264 static bool is_enabled() { return false; } |
260 #endif | 265 #endif |
261 }; | 266 }; |
262 | 267 |
263 | 268 |
264 // Class that extracts stack trace, used for profiling. | 269 // Class that extracts stack trace, used for profiling. |
265 class StackTracer BASE_EMBEDDED { | 270 class StackTracer BASE_EMBEDDED { |
266 public: | 271 public: |
267 explicit StackTracer(uintptr_t low_stack_bound) | 272 explicit StackTracer(uintptr_t low_stack_bound) |
268 : low_stack_bound_(low_stack_bound) { } | 273 : low_stack_bound_(low_stack_bound) { } |
269 void Trace(TickSample* sample); | 274 void Trace(TickSample* sample); |
270 private: | 275 private: |
271 | 276 |
272 uintptr_t low_stack_bound_; | 277 uintptr_t low_stack_bound_; |
273 }; | 278 }; |
274 | 279 |
275 | 280 |
276 } } // namespace v8::internal | 281 } } // namespace v8::internal |
277 | 282 |
278 #endif // V8_LOG_H_ | 283 #endif // V8_LOG_H_ |
OLD | NEW |