| OLD | NEW |
| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/heap/gc-tracer.h" | 7 #include "src/heap/gc-tracer.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 PrintIsolate(heap_->isolate(), "[I:%p] %8.0f ms: ", heap_->isolate(), | 392 PrintIsolate(heap_->isolate(), "[I:%p] %8.0f ms: ", heap_->isolate(), |
| 393 heap_->isolate()->time_millis_since_init()); | 393 heap_->isolate()->time_millis_since_init()); |
| 394 | 394 |
| 395 double duration = current_.end_time - current_.start_time; | 395 double duration = current_.end_time - current_.start_time; |
| 396 double spent_in_mutator = current_.start_time - previous_.end_time; | 396 double spent_in_mutator = current_.start_time - previous_.end_time; |
| 397 | 397 |
| 398 PrintF("pause=%.1f ", duration); | 398 PrintF("pause=%.1f ", duration); |
| 399 PrintF("mutator=%.1f ", spent_in_mutator); | 399 PrintF("mutator=%.1f ", spent_in_mutator); |
| 400 PrintF("gc=%s ", current_.TypeName(true)); | 400 PrintF("gc=%s ", current_.TypeName(true)); |
| 401 | 401 |
| 402 PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]); | 402 switch (current_.type) { |
| 403 PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]); | 403 case Event::SCAVENGER: |
| 404 PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]); | 404 PrintF("scavenge=%.2f ", current_.scopes[Scope::SCAVENGER_SCAVENGE]); |
| 405 PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]); | 405 PrintF("old_new=%.2f ", |
| 406 PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]); | 406 current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS]); |
| 407 PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]); | 407 PrintF("weak=%.2f ", current_.scopes[Scope::SCAVENGER_WEAK]); |
| 408 PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]); | 408 PrintF("roots=%.2f ", current_.scopes[Scope::SCAVENGER_ROOTS]); |
| 409 PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]); | 409 PrintF("code=%.2f ", |
| 410 PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]); | 410 current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES]); |
| 411 PrintF("new_new=%.1f ", | 411 PrintF("semispace=%.2f ", current_.scopes[Scope::SCAVENGER_SEMISPACE]); |
| 412 current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]); | 412 PrintF("object_groups=%.2f ", |
| 413 PrintF("root_new=%.1f ", | 413 current_.scopes[Scope::SCAVENGER_OBJECT_GROUPS]); |
| 414 current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]); | 414 PrintF("steps_count=%d ", current_.incremental_marking_steps); |
| 415 PrintF("old_new=%.1f ", | 415 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); |
| 416 current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]); | 416 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", |
| 417 PrintF("compaction_ptrs=%.1f ", | 417 ScavengeSpeedInBytesPerMillisecond()); |
| 418 current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]); | 418 break; |
| 419 PrintF("intracompaction_ptrs=%.1f ", | 419 case Event::MARK_COMPACTOR: |
| 420 current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]); | 420 case Event::INCREMENTAL_MARK_COMPACTOR: |
| 421 PrintF("misc_compaction=%.1f ", | 421 PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]); |
| 422 current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]); | 422 PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]); |
| 423 PrintF("weak_closure=%.1f ", current_.scopes[Scope::MC_WEAKCLOSURE]); | 423 PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]); |
| 424 PrintF("inc_weak_closure=%.1f ", | 424 PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]); |
| 425 current_.scopes[Scope::MC_INCREMENTAL_WEAKCLOSURE]); | 425 PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]); |
| 426 PrintF("weakcollection_process=%.1f ", | 426 PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]); |
| 427 current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]); | 427 PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]); |
| 428 PrintF("weakcollection_clear=%.1f ", | 428 PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]); |
| 429 current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR]); | 429 PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]); |
| 430 PrintF("weakcollection_abort=%.1f ", | 430 PrintF("new_new=%.1f ", |
| 431 current_.scopes[Scope::MC_WEAKCOLLECTION_ABORT]); | 431 current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]); |
| 432 PrintF("root_new=%.1f ", |
| 433 current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]); |
| 434 PrintF("old_new=%.1f ", |
| 435 current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]); |
| 436 PrintF("compaction_ptrs=%.1f ", |
| 437 current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]); |
| 438 PrintF("intracompaction_ptrs=%.1f ", |
| 439 current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]); |
| 440 PrintF("misc_compaction=%.1f ", |
| 441 current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]); |
| 442 PrintF("weak_closure=%.1f ", current_.scopes[Scope::MC_WEAKCLOSURE]); |
| 443 PrintF("inc_weak_closure=%.1f ", |
| 444 current_.scopes[Scope::MC_INCREMENTAL_WEAKCLOSURE]); |
| 445 PrintF("weakcollection_process=%.1f ", |
| 446 current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]); |
| 447 PrintF("weakcollection_clear=%.1f ", |
| 448 current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR]); |
| 449 PrintF("weakcollection_abort=%.1f ", |
| 450 current_.scopes[Scope::MC_WEAKCOLLECTION_ABORT]); |
| 451 |
| 452 PrintF("steps_count=%d ", current_.incremental_marking_steps); |
| 453 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); |
| 454 PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step); |
| 455 PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ", |
| 456 IncrementalMarkingSpeedInBytesPerMillisecond()); |
| 457 break; |
| 458 case Event::START: |
| 459 break; |
| 460 default: |
| 461 UNREACHABLE(); |
| 462 } |
| 432 | 463 |
| 433 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", current_.start_object_size); | 464 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", current_.start_object_size); |
| 434 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", current_.end_object_size); | 465 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", current_.end_object_size); |
| 435 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", current_.start_holes_size); | 466 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", current_.start_holes_size); |
| 436 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", current_.end_holes_size); | 467 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", current_.end_holes_size); |
| 437 | 468 |
| 438 intptr_t allocated_since_last_gc = | 469 intptr_t allocated_since_last_gc = |
| 439 current_.start_object_size - previous_.end_object_size; | 470 current_.start_object_size - previous_.end_object_size; |
| 440 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); | 471 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); |
| 441 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); | 472 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); |
| 442 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", | 473 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", |
| 443 heap_->semi_space_copied_object_size_); | 474 heap_->semi_space_copied_object_size_); |
| 444 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); | 475 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); |
| 445 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); | 476 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); |
| 446 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); | 477 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); |
| 447 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); | 478 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); |
| 448 PrintF("average_survival_ratio=%.1f%% ", AverageSurvivalRatio()); | 479 PrintF("average_survival_ratio=%.1f%% ", AverageSurvivalRatio()); |
| 449 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); | 480 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); |
| 450 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); | 481 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); |
| 451 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", | 482 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", |
| 452 NewSpaceAllocationThroughputInBytesPerMillisecond()); | 483 NewSpaceAllocationThroughputInBytesPerMillisecond()); |
| 453 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); | 484 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); |
| 454 | 485 |
| 455 if (current_.type == Event::SCAVENGER) { | |
| 456 PrintF("steps_count=%d ", current_.incremental_marking_steps); | |
| 457 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); | |
| 458 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", | |
| 459 ScavengeSpeedInBytesPerMillisecond()); | |
| 460 } else { | |
| 461 PrintF("steps_count=%d ", current_.incremental_marking_steps); | |
| 462 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); | |
| 463 PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step); | |
| 464 PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ", | |
| 465 IncrementalMarkingSpeedInBytesPerMillisecond()); | |
| 466 } | |
| 467 | |
| 468 PrintF("\n"); | 486 PrintF("\n"); |
| 469 } | 487 } |
| 470 | 488 |
| 471 | 489 |
| 472 double GCTracer::MeanDuration(const EventBuffer& events) const { | 490 double GCTracer::MeanDuration(const EventBuffer& events) const { |
| 473 if (events.empty()) return 0.0; | 491 if (events.empty()) return 0.0; |
| 474 | 492 |
| 475 double mean = 0.0; | 493 double mean = 0.0; |
| 476 EventBuffer::const_iterator iter = events.begin(); | 494 EventBuffer::const_iterator iter = events.begin(); |
| 477 while (iter != events.end()) { | 495 while (iter != events.end()) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 739 |
| 722 | 740 |
| 723 bool GCTracer::SurvivalEventsRecorded() const { | 741 bool GCTracer::SurvivalEventsRecorded() const { |
| 724 return survival_events_.size() > 0; | 742 return survival_events_.size() > 0; |
| 725 } | 743 } |
| 726 | 744 |
| 727 | 745 |
| 728 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 746 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
| 729 } // namespace internal | 747 } // namespace internal |
| 730 } // namespace v8 | 748 } // namespace v8 |
| OLD | NEW |