Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: src/log.h

Issue 537833002: Make logger use new sampling API for ticks and code events. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_LOG_H_ 5 #ifndef V8_LOG_H_
6 #define V8_LOG_H_ 6 #define V8_LOG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void addCodeEventListener(CodeEventListener* listener); 222 void addCodeEventListener(CodeEventListener* listener);
223 void removeCodeEventListener(CodeEventListener* listener); 223 void removeCodeEventListener(CodeEventListener* listener);
224 bool hasCodeEventListener(CodeEventListener* listener); 224 bool hasCodeEventListener(CodeEventListener* listener);
225 225
226 226
227 // Emits a code event for a callback function. 227 // Emits a code event for a callback function.
228 void CallbackEvent(Name* name, Address entry_point); 228 void CallbackEvent(Name* name, Address entry_point);
229 void GetterCallbackEvent(Name* name, Address entry_point); 229 void GetterCallbackEvent(Name* name, Address entry_point);
230 void SetterCallbackEvent(Name* name, Address entry_point); 230 void SetterCallbackEvent(Name* name, Address entry_point);
231 // Emits a code create event. 231 // Emits a code create event.
232 void CodeCreateEvent(const v8::JitCodeEvent* event);
232 void CodeCreateEvent(LogEventsAndTags tag, 233 void CodeCreateEvent(LogEventsAndTags tag,
233 Code* code, const char* source); 234 Code* code, const char* source);
234 void CodeCreateEvent(LogEventsAndTags tag, 235 void CodeCreateEvent(LogEventsAndTags tag,
235 Code* code, Name* name); 236 Code* code, Name* name);
236 void CodeCreateEvent(LogEventsAndTags tag, 237 void CodeCreateEvent(LogEventsAndTags tag,
237 Code* code, 238 Code* code,
238 SharedFunctionInfo* shared, 239 SharedFunctionInfo* shared,
239 CompilationInfo* info, 240 CompilationInfo* info,
240 Name* name); 241 Name* name);
241 void CodeCreateEvent(LogEventsAndTags tag, 242 void CodeCreateEvent(LogEventsAndTags tag,
242 Code* code, 243 Code* code,
243 SharedFunctionInfo* shared, 244 SharedFunctionInfo* shared,
244 CompilationInfo* info, 245 CompilationInfo* info,
245 Name* source, int line, int column); 246 Name* source, int line, int column);
246 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); 247 void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count);
247 // Emits a code deoptimization event. 248 // Emits a code deoptimization event.
248 void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared); 249 void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared);
249 void CodeMovingGCEvent(); 250 void CodeMovingGCEvent();
250 // Emits a code create event for a RegExp. 251 // Emits a code create event for a RegExp.
251 void RegExpCodeCreateEvent(Code* code, String* source); 252 void RegExpCodeCreateEvent(Code* code, String* source);
252 // Emits a code move event. 253 // Emit a code move event.
254 void CodeMoveEvent(const v8::JitCodeEvent* event);
253 void CodeMoveEvent(Address from, Address to); 255 void CodeMoveEvent(Address from, Address to);
254 // Emits a code delete event. 256 // Emit a code delete event.
257 void CodeDeleteEvent(const v8::JitCodeEvent* event);
255 void CodeDeleteEvent(Address from); 258 void CodeDeleteEvent(Address from);
256 // Emits a code line info add event with Postion type. 259 // Emits a code line info add event with Postion type.
257 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, 260 void CodeLinePosInfoAddPositionEvent(void* jit_handler_data,
258 int pc_offset, 261 int pc_offset,
259 int position); 262 int position);
260 // Emits a code line info add event with StatementPostion type. 263 // Emits a code line info add event with StatementPostion type.
261 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, 264 void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data,
262 int pc_offset, 265 int pc_offset,
263 int position); 266 int position);
264 // Emits a code line info start to record event 267 // Emits a code line info start to record event
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 static const char* v8_compile_full_code; 325 static const char* v8_compile_full_code;
323 static const char* v8_execute; 326 static const char* v8_execute;
324 static const char* v8_external; 327 static const char* v8_external;
325 static const char* v8_ic_miss; 328 static const char* v8_ic_miss;
326 329
327 private: 330 private:
328 Isolate* isolate_; 331 Isolate* isolate_;
329 const char* name_; 332 const char* name_;
330 }; 333 };
331 334
335
336 class SamplerThread : public v8::base::Thread {
337 public:
338 explicit SamplerThread(v8::Isolate* isolate);
339 virtual ~SamplerThread();
340 virtual void Run();
341
342 private:
343 static void JitCodeEventHandler(const v8::JitCodeEvent* event);
344 v8::Isolate* isolate_;
345 bool done_sampling_;
346 };
347
348
332 // ==== Events logged by --log-regexp ==== 349 // ==== Events logged by --log-regexp ====
333 // Regexp compilation and execution events. 350 // Regexp compilation and execution events.
334 351
335 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); 352 void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache);
336 353
337 bool is_logging() { 354 bool is_logging() {
338 return is_logging_; 355 return is_logging_;
339 } 356 }
340 357
341 bool is_logging_code_events() { 358 bool is_logging_code_events() {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // Emits the source code of a regexp. Used by regexp events. 405 // Emits the source code of a regexp. Used by regexp events.
389 void LogRegExpSource(Handle<JSRegExp> regexp); 406 void LogRegExpSource(Handle<JSRegExp> regexp);
390 407
391 // Used for logging stubs found in the snapshot. 408 // Used for logging stubs found in the snapshot.
392 void LogCodeObject(Object* code_object); 409 void LogCodeObject(Object* code_object);
393 410
394 // Helper method. It resets name_buffer_ and add tag name into it. 411 // Helper method. It resets name_buffer_ and add tag name into it.
395 void InitNameBuffer(LogEventsAndTags tag); 412 void InitNameBuffer(LogEventsAndTags tag);
396 413
397 // Emits a profiler tick event. Used by the profiler thread. 414 // Emits a profiler tick event. Used by the profiler thread.
398 void TickEvent(TickSample* sample, bool overflow); 415 void TickEvent(TickSample* sample, bool overflow) {}
416
417 void LogSample(v8::Sample* sample);
399 418
400 void ApiEvent(const char* name, ...); 419 void ApiEvent(const char* name, ...);
401 420
402 // Logs a StringEvent regardless of whether FLAG_log is true. 421 // Logs a StringEvent regardless of whether FLAG_log is true.
403 void UncheckedStringEvent(const char* name, const char* value); 422 void UncheckedStringEvent(const char* name, const char* value);
404 423
405 // Logs an IntEvent regardless of whether FLAG_log is true. 424 // Logs an IntEvent regardless of whether FLAG_log is true.
406 void UncheckedIntEvent(const char* name, int value); 425 void UncheckedIntEvent(const char* name, int value);
407 void UncheckedIntPtrTEvent(const char* name, intptr_t value); 426 void UncheckedIntPtrTEvent(const char* name, intptr_t value);
408 427
(...skipping 19 matching lines...) Expand all
428 template <StateTag Tag> friend class VMState; 447 template <StateTag Tag> friend class VMState;
429 friend class LoggerTestHelper; 448 friend class LoggerTestHelper;
430 449
431 bool is_logging_; 450 bool is_logging_;
432 Log* log_; 451 Log* log_;
433 PerfBasicLogger* perf_basic_logger_; 452 PerfBasicLogger* perf_basic_logger_;
434 PerfJitLogger* perf_jit_logger_; 453 PerfJitLogger* perf_jit_logger_;
435 LowLevelLogger* ll_logger_; 454 LowLevelLogger* ll_logger_;
436 JitLogger* jit_logger_; 455 JitLogger* jit_logger_;
437 List<CodeEventListener*> listeners_; 456 List<CodeEventListener*> listeners_;
457 SamplerThread* sampler_thread_;
438 458
439 // Guards against multiple calls to TearDown() that can happen in some tests. 459 // Guards against multiple calls to TearDown() that can happen in some tests.
440 // 'true' between SetUp() and TearDown(). 460 // 'true' between SetUp() and TearDown().
441 bool is_initialized_; 461 bool is_initialized_;
442 462
443 base::ElapsedTimer timer_; 463 base::ElapsedTimer timer_;
444 464
445 friend class CpuProfiler; 465 friend class CpuProfiler;
446 }; 466 };
447 467
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 int length) = 0; 544 int length) = 0;
525 545
526 NameBuffer* name_buffer_; 546 NameBuffer* name_buffer_;
527 }; 547 };
528 548
529 549
530 } } // namespace v8::internal 550 } } // namespace v8::internal
531 551
532 552
533 #endif // V8_LOG_H_ 553 #endif // V8_LOG_H_
OLDNEW
« no previous file with comments | « no previous file | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698