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

Side by Side Diff: src/heap/gc-tracer.cc

Issue 1406173002: [heap] Make --trace-gc-nvp output adb logcat friendly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/heap/gc-tracer.h" 5 #include "src/heap/gc-tracer.h"
6 6
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/heap/heap-inl.h" 8 #include "src/heap/heap-inl.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 10
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 if (current_.collector_reason != NULL) { 387 if (current_.collector_reason != NULL) {
388 Output(" [%s]", current_.collector_reason); 388 Output(" [%s]", current_.collector_reason);
389 } 389 }
390 390
391 Output(".\n"); 391 Output(".\n");
392 } 392 }
393 393
394 394
395 void GCTracer::PrintNVP() const { 395 void GCTracer::PrintNVP() const {
396 PrintIsolate(heap_->isolate(), "[I:%p] %8.0f ms: ", heap_->isolate(),
397 heap_->isolate()->time_millis_since_init());
398
399 double duration = current_.end_time - current_.start_time; 396 double duration = current_.end_time - current_.start_time;
400 double spent_in_mutator = current_.start_time - previous_.end_time; 397 double spent_in_mutator = current_.start_time - previous_.end_time;
401 398 intptr_t allocated_since_last_gc =
402 PrintF("pause=%.1f ", duration); 399 current_.start_object_size - previous_.end_object_size;
403 PrintF("mutator=%.1f ", spent_in_mutator);
404 PrintF("gc=%s ", current_.TypeName(true));
405 PrintF("reduce_memory=%d ", current_.reduce_memory);
406 400
407 switch (current_.type) { 401 switch (current_.type) {
408 case Event::SCAVENGER: 402 case Event::SCAVENGER:
409 PrintF("scavenge=%.2f ", current_.scopes[Scope::SCAVENGER_SCAVENGE]); 403 PrintIsolate(heap_->isolate(),
410 PrintF("old_new=%.2f ", 404 "[I:%p] %8.0f ms: "
411 current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS]); 405 "pause=%.1f "
412 PrintF("weak=%.2f ", current_.scopes[Scope::SCAVENGER_WEAK]); 406 "mutator=%.1f "
413 PrintF("roots=%.2f ", current_.scopes[Scope::SCAVENGER_ROOTS]); 407 "gc=%s "
414 PrintF("code=%.2f ", 408 "reduce_memory=%d "
415 current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES]); 409 "scavenge=%.2f "
416 PrintF("semispace=%.2f ", current_.scopes[Scope::SCAVENGER_SEMISPACE]); 410 "old_new=%.2f "
417 PrintF("object_groups=%.2f ", 411 "weak=%.2f "
418 current_.scopes[Scope::SCAVENGER_OBJECT_GROUPS]); 412 "roots=%.2f "
419 PrintF("steps_count=%d ", current_.incremental_marking_steps); 413 "code=%.2f "
420 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); 414 "semispace=%.2f "
421 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", 415 "object_groups=%.2f "
422 ScavengeSpeedInBytesPerMillisecond()); 416 "steps_count=%d "
417 "steps_took=%.1f "
418 "scavenge_throughput=%" V8_PTR_PREFIX "d "
419 "total_size_before=%" V8_PTR_PREFIX "d "
420 "total_size_after=%" V8_PTR_PREFIX "d "
421 "holes_size_before=%" V8_PTR_PREFIX "d "
422 "holes_size_after=%" V8_PTR_PREFIX "d "
423 "allocated=%" V8_PTR_PREFIX "d "
424 "promoted=%" V8_PTR_PREFIX "d "
425 "semi_space_copied=%" V8_PTR_PREFIX "d "
426 "nodes_died_in_new=%d "
427 "nodes_copied_in_new=%d "
428 "nodes_promoted=%d "
429 "promotion_ratio=%.1f%% "
430 "average_survival_ratio=%.1f%% "
431 "promotion_rate=%.1f%% "
432 "semi_space_copy_rate=%.1f%% "
433 "new_space_allocation_throughput=%" V8_PTR_PREFIX "d "
434 "context_disposal_rate=%.1f\n",
435 heap_->isolate(),
436 heap_->isolate()->time_millis_since_init(),
437 duration,
438 spent_in_mutator,
439 current_.TypeName(true),
440 current_.reduce_memory,
441 current_.scopes[Scope::SCAVENGER_SCAVENGE],
442 current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS],
443 current_.scopes[Scope::SCAVENGER_WEAK],
444 current_.scopes[Scope::SCAVENGER_ROOTS],
445 current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES],
446 current_.scopes[Scope::SCAVENGER_SEMISPACE],
447 current_.scopes[Scope::SCAVENGER_OBJECT_GROUPS],
448 current_.incremental_marking_steps,
449 current_.incremental_marking_duration,
450 ScavengeSpeedInBytesPerMillisecond(),
451 current_.start_object_size, current_.end_object_size,
452 current_.start_holes_size, current_.end_holes_size,
453 allocated_since_last_gc, heap_->promoted_objects_size(),
454 heap_->semi_space_copied_object_size(),
455 heap_->nodes_died_in_new_space_,
456 heap_->nodes_copied_in_new_space_, heap_->nodes_promoted_,
457 heap_->promotion_ratio_, AverageSurvivalRatio(),
458 heap_->promotion_rate_, heap_->semi_space_copied_rate_,
459 NewSpaceAllocationThroughputInBytesPerMillisecond(),
460 ContextDisposalRateInMilliseconds());
423 break; 461 break;
424 case Event::MARK_COMPACTOR: 462 case Event::MARK_COMPACTOR:
425 case Event::INCREMENTAL_MARK_COMPACTOR: 463 case Event::INCREMENTAL_MARK_COMPACTOR:
426 PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]); 464 PrintIsolate(heap_->isolate(),
427 PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]); 465 "[I:%p] %8.0f ms: "
428 PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]); 466 "pause=%.1f "
429 PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]); 467 "mutator=%.1f "
430 PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]); 468 "gc=%s "
431 PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]); 469 "reduce_memory=%d "
432 PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]); 470 "external=%.1f "
433 PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]); 471 "mark=%.1f "
434 PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]); 472 "sweep=%.2f "
435 PrintF("new_new=%.1f ", 473 "sweepns=%.2f "
436 current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]); 474 "sweepos=%.2f "
437 PrintF("root_new=%.1f ", 475 "sweepcode=%.2f "
438 current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]); 476 "sweepcell=%.2f "
439 PrintF("old_new=%.1f ", 477 "sweepmap=%.2f "
440 current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]); 478 "evacuate=%.1f "
441 PrintF("compaction_ptrs=%.1f ", 479 "new_new=%.1f "
442 current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]); 480 "root_new=%.1f "
443 PrintF("intracompaction_ptrs=%.1f ", 481 "old_new=%.1f "
444 current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]); 482 "compaction_ptrs=%.1f "
445 PrintF("misc_compaction=%.1f ", 483 "intracompaction_ptrs=%.1f "
446 current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]); 484 "misc_compaction=%.1f "
447 PrintF("weak_closure=%.1f ", current_.scopes[Scope::MC_WEAKCLOSURE]); 485 "weak_closure=%.1f "
448 PrintF("inc_weak_closure=%.1f ", 486 "inc_weak_closure=%.1f "
449 current_.scopes[Scope::MC_INCREMENTAL_WEAKCLOSURE]); 487 "weakcollection_process=%.1f "
450 PrintF("weakcollection_process=%.1f ", 488 "weakcollection_clear=%.1f "
451 current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]); 489 "weakcollection_abort=%.1f "
452 PrintF("weakcollection_clear=%.1f ", 490 "weakcells=%.1f "
453 current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR]); 491 "nonlive_refs=%.1f "
454 PrintF("weakcollection_abort=%.1f ", 492 "steps_count=%d "
455 current_.scopes[Scope::MC_WEAKCOLLECTION_ABORT]); 493 "steps_took=%.1f "
456 PrintF("weakcells=%.1f ", current_.scopes[Scope::MC_WEAKCELL]); 494 "longest_step=%.1f "
457 PrintF("nonlive_refs=%.1f ", 495 "incremental_marking_throughput=%" V8_PTR_PREFIX "d "
458 current_.scopes[Scope::MC_NONLIVEREFERENCES]); 496 "total_size_before=%" V8_PTR_PREFIX "d "
459 497 "total_size_after=%" V8_PTR_PREFIX "d "
460 PrintF("steps_count=%d ", current_.incremental_marking_steps); 498 "holes_size_before=%" V8_PTR_PREFIX "d "
461 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); 499 "holes_size_after=%" V8_PTR_PREFIX "d "
462 PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step); 500 "allocated=%" V8_PTR_PREFIX "d "
463 PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ", 501 "promoted=%" V8_PTR_PREFIX "d "
464 IncrementalMarkingSpeedInBytesPerMillisecond()); 502 "semi_space_copied=%" V8_PTR_PREFIX "d "
503 "nodes_died_in_new=%d "
504 "nodes_copied_in_new=%d "
505 "nodes_promoted=%d "
506 "promotion_ratio=%.1f%% "
507 "average_survival_ratio=%.1f%% "
508 "promotion_rate=%.1f%% "
509 "semi_space_copy_rate=%.1f%% "
510 "new_space_allocation_throughput=%" V8_PTR_PREFIX "d "
511 "context_disposal_rate=%.1f\n",
512 heap_->isolate(),
513 heap_->isolate()->time_millis_since_init(),
514 duration, spent_in_mutator,
515 current_.TypeName(true),
516 current_.reduce_memory,
517 current_.scopes[Scope::EXTERNAL],
518 current_.scopes[Scope::MC_MARK],
519 current_.scopes[Scope::MC_SWEEP],
520 current_.scopes[Scope::MC_SWEEP_NEWSPACE],
521 current_.scopes[Scope::MC_SWEEP_OLDSPACE],
522 current_.scopes[Scope::MC_SWEEP_CODE],
523 current_.scopes[Scope::MC_SWEEP_CELL],
524 current_.scopes[Scope::MC_SWEEP_MAP],
525 current_.scopes[Scope::MC_EVACUATE_PAGES],
526 current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS],
527 current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS],
528 current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS],
529 current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED],
530 current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED],
531 current_.scopes[Scope::MC_UPDATE_MISC_POINTERS],
532 current_.scopes[Scope::MC_WEAKCLOSURE],
533 current_.scopes[Scope::MC_INCREMENTAL_WEAKCLOSURE],
534 current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS],
535 current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR],
536 current_.scopes[Scope::MC_WEAKCOLLECTION_ABORT],
537 current_.scopes[Scope::MC_WEAKCELL],
538 current_.scopes[Scope::MC_NONLIVEREFERENCES],
539 current_.incremental_marking_steps,
540 current_.incremental_marking_duration,
541 current_.longest_incremental_marking_step,
542 IncrementalMarkingSpeedInBytesPerMillisecond(),
543 current_.start_object_size, current_.end_object_size,
544 current_.start_holes_size, current_.end_holes_size,
545 allocated_since_last_gc, heap_->promoted_objects_size(),
546 heap_->semi_space_copied_object_size(),
547 heap_->nodes_died_in_new_space_,
548 heap_->nodes_copied_in_new_space_, heap_->nodes_promoted_,
549 heap_->promotion_ratio_, AverageSurvivalRatio(),
550 heap_->promotion_rate_, heap_->semi_space_copied_rate_,
551 NewSpaceAllocationThroughputInBytesPerMillisecond(),
552 ContextDisposalRateInMilliseconds());
465 break; 553 break;
466 case Event::START: 554 case Event::START:
467 break; 555 break;
468 default: 556 default:
469 UNREACHABLE(); 557 UNREACHABLE();
470 } 558 }
471
472 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", current_.start_object_size);
473 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", current_.end_object_size);
474 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", current_.start_holes_size);
475 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", current_.end_holes_size);
476
477 intptr_t allocated_since_last_gc =
478 current_.start_object_size - previous_.end_object_size;
479 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc);
480 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size());
481 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
482 heap_->semi_space_copied_object_size());
483 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_);
484 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
485 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
486 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_);
487 PrintF("average_survival_ratio=%.1f%% ", AverageSurvivalRatio());
488 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
489 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
490 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
491 NewSpaceAllocationThroughputInBytesPerMillisecond());
492 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds());
493
494 PrintF("\n");
495 } 559 }
496 560
497 561
498 double GCTracer::MeanDuration(const EventBuffer& events) const { 562 double GCTracer::MeanDuration(const EventBuffer& events) const {
499 if (events.empty()) return 0.0; 563 if (events.empty()) return 0.0;
500 564
501 double mean = 0.0; 565 double mean = 0.0;
502 EventBuffer::const_iterator iter = events.begin(); 566 EventBuffer::const_iterator iter = events.begin();
503 while (iter != events.end()) { 567 while (iter != events.end()) {
504 mean += iter->end_time - iter->start_time; 568 mean += iter->end_time - iter->start_time;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 815
752 816
753 bool GCTracer::SurvivalEventsRecorded() const { 817 bool GCTracer::SurvivalEventsRecorded() const {
754 return survival_events_.size() > 0; 818 return survival_events_.size() > 0;
755 } 819 }
756 820
757 821
758 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } 822 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
759 } // namespace internal 823 } // namespace internal
760 } // namespace v8 824 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698