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

Side by Side Diff: src/log.h

Issue 19795002: Logger: extract CodeEventLogger classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 5 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 // 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // --log-regexp implies --log. 63 // --log-regexp implies --log.
64 // 64 //
65 // --logfile <filename> 65 // --logfile <filename>
66 // Specify the name of the logfile, default is "v8.log". 66 // Specify the name of the logfile, default is "v8.log".
67 // 67 //
68 // --prof 68 // --prof
69 // Collect statistical profiling information (ticks), default is off. The 69 // Collect statistical profiling information (ticks), default is off. The
70 // tick profiler requires code events, so --prof implies --log-code. 70 // tick profiler requires code events, so --prof implies --log-code.
71 71
72 // Forward declarations. 72 // Forward declarations.
73 class CodeAddressMap;
73 class CompilationInfo; 74 class CompilationInfo;
74 class CpuProfiler; 75 class CpuProfiler;
75 class Isolate; 76 class Isolate;
76 class Log; 77 class Log;
77 class PositionsRecorder; 78 class PositionsRecorder;
78 class Profiler; 79 class Profiler;
79 class Semaphore; 80 class Semaphore;
80 class Ticker; 81 class Ticker;
81 struct TickSample; 82 struct TickSample;
82 83
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // and laptop computers for which current heuristics are tuned. 367 // and laptop computers for which current heuristics are tuned.
367 static const int kSamplingIntervalMs = 5; 368 static const int kSamplingIntervalMs = 5;
368 #else 369 #else
369 static const int kSamplingIntervalMs = 1; 370 static const int kSamplingIntervalMs = 1;
370 #endif 371 #endif
371 372
372 // Callback from Log, stops profiling in case of insufficient resources. 373 // Callback from Log, stops profiling in case of insufficient resources.
373 void LogFailure(); 374 void LogFailure();
374 375
375 private: 376 private:
376 class NameBuffer;
377 class NameMap;
378
379 explicit Logger(Isolate* isolate); 377 explicit Logger(Isolate* isolate);
380 ~Logger(); 378 ~Logger();
381 379
382 // Emits the profiler's first message. 380 // Emits the profiler's first message.
383 void ProfilerBeginEvent(); 381 void ProfilerBeginEvent();
384 382
385 // Emits callback event messages. 383 // Emits callback event messages.
386 void CallbackEventInternal(const char* prefix, 384 void CallbackEventInternal(const char* prefix,
387 Name* name, 385 Name* name,
388 Address entry_point); 386 Address entry_point);
389 387
390 // Internal configurable move event. 388 // Internal configurable move event.
391 void MoveEventInternal(LogEventsAndTags event, Address from, Address to); 389 void MoveEventInternal(LogEventsAndTags event, Address from, Address to);
392 390
393 // Internal configurable move event. 391 // Internal configurable move event.
394 void DeleteEventInternal(LogEventsAndTags event, Address from); 392 void DeleteEventInternal(LogEventsAndTags event, Address from);
395 393
396 // Emits the source code of a regexp. Used by regexp events. 394 // Emits the source code of a regexp. Used by regexp events.
397 void LogRegExpSource(Handle<JSRegExp> regexp); 395 void LogRegExpSource(Handle<JSRegExp> regexp);
398 396
399 // Used for logging stubs found in the snapshot. 397 // Used for logging stubs found in the snapshot.
400 void LogCodeObject(Object* code_object); 398 void LogCodeObject(Object* code_object);
401 399
402 // Helper method. It resets name_buffer_ and add tag name into it. 400 // Helper method. It resets name_buffer_ and add tag name into it.
403 void InitNameBuffer(LogEventsAndTags tag); 401 void InitNameBuffer(LogEventsAndTags tag);
404 402
405 // Helper method. It push recorded buffer into different handlers.
406 void LogRecordedBuffer(Code*, SharedFunctionInfo*);
407
408 // Helper method. It dumps name into name_buffer_.
409 void AppendName(Name* name);
410
411 void RegisterSnapshotCodeName(Code* code, const char* name, int name_size);
412
413 // Emits a profiler tick event. Used by the profiler thread. 403 // Emits a profiler tick event. Used by the profiler thread.
414 void TickEvent(TickSample* sample, bool overflow); 404 void TickEvent(TickSample* sample, bool overflow);
415 405
416 void ApiEvent(const char* name, ...); 406 void ApiEvent(const char* name, ...);
417 407
418 // Logs a StringEvent regardless of whether FLAG_log is true. 408 // Logs a StringEvent regardless of whether FLAG_log is true.
419 void UncheckedStringEvent(const char* name, const char* value); 409 void UncheckedStringEvent(const char* name, const char* value);
420 410
421 // Logs an IntEvent regardless of whether FLAG_log is true. 411 // Logs an IntEvent regardless of whether FLAG_log is true.
422 void UncheckedIntEvent(const char* name, int value); 412 void UncheckedIntEvent(const char* name, int value);
(...skipping 22 matching lines...) Expand all
445 435
446 friend class LoggerTestHelper; 436 friend class LoggerTestHelper;
447 437
448 438
449 int logging_nesting_; 439 int logging_nesting_;
450 int cpu_profiler_nesting_; 440 int cpu_profiler_nesting_;
451 441
452 Log* log_; 442 Log* log_;
453 LowLevelLogger* ll_logger_; 443 LowLevelLogger* ll_logger_;
454 JitLogger* jit_logger_; 444 JitLogger* jit_logger_;
455 445 CodeAddressMap* code_address_map_;
456 NameBuffer* name_buffer_;
457
458 NameMap* address_to_name_map_;
459 446
460 // Guards against multiple calls to TearDown() that can happen in some tests. 447 // Guards against multiple calls to TearDown() that can happen in some tests.
461 // 'true' between SetUp() and TearDown(). 448 // 'true' between SetUp() and TearDown().
462 bool is_initialized_; 449 bool is_initialized_;
463 450
464 // Support for 'incremental addresses' in compressed logs: 451 // Support for 'incremental addresses' in compressed logs:
465 // LogMessageBuilder::AppendAddress(Address addr) 452 // LogMessageBuilder::AppendAddress(Address addr)
466 Address last_address_; 453 Address last_address_;
467 // Logger::TickEvent(...) 454 // Logger::TickEvent(...)
468 Address prev_sp_; 455 Address prev_sp_;
469 Address prev_function_; 456 Address prev_function_;
470 // Logger::MoveEventInternal(...) 457 // Logger::MoveEventInternal(...)
471 Address prev_to_; 458 Address prev_to_;
472 // Logger::FunctionCreateEvent(...) 459 // Logger::FunctionCreateEvent(...)
473 Address prev_code_; 460 Address prev_code_;
474 461
475 int64_t epoch_; 462 int64_t epoch_;
476 463
477 friend class CpuProfiler; 464 friend class CpuProfiler;
478 }; 465 };
479 466
480 467
481 } } // namespace v8::internal 468 } } // namespace v8::internal
482 469
483 470
484 #endif // V8_LOG_H_ 471 #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