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

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

Issue 1410633005: [heap] Base number of compaction tasks on live memory and compaction speed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Restore 1st version of profiling evacuation performance Created 5 years, 1 month 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 | « src/heap/gc-tracer.h ('k') | src/heap/mark-compact.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 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 new_space_allocation_in_bytes_since_gc_ = 0; 302 new_space_allocation_in_bytes_since_gc_ = 0;
303 old_generation_allocation_in_bytes_since_gc_ = 0; 303 old_generation_allocation_in_bytes_since_gc_ = 0;
304 } 304 }
305 305
306 306
307 void GCTracer::AddContextDisposalTime(double time) { 307 void GCTracer::AddContextDisposalTime(double time) {
308 context_disposal_events_.push_front(ContextDisposalEvent(time)); 308 context_disposal_events_.push_front(ContextDisposalEvent(time));
309 } 309 }
310 310
311 311
312 void GCTracer::AddCompactionEvent(double duration,
313 intptr_t live_bytes_compacted) {
314 compaction_events_.push_front(
315 CompactionEvent(duration, live_bytes_compacted));
316 }
317
318
312 void GCTracer::AddSurvivalRatio(double promotion_ratio) { 319 void GCTracer::AddSurvivalRatio(double promotion_ratio) {
313 survival_events_.push_front(SurvivalEvent(promotion_ratio)); 320 survival_events_.push_front(SurvivalEvent(promotion_ratio));
314 } 321 }
315 322
316 323
317 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { 324 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) {
318 cumulative_incremental_marking_steps_++; 325 cumulative_incremental_marking_steps_++;
319 cumulative_incremental_marking_bytes_ += bytes; 326 cumulative_incremental_marking_bytes_ += bytes;
320 cumulative_incremental_marking_duration_ += duration; 327 cumulative_incremental_marking_duration_ += duration;
321 longest_incremental_marking_step_ = 328 longest_incremental_marking_step_ =
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 "d " 535 "d "
529 "nodes_died_in_new=%d " 536 "nodes_died_in_new=%d "
530 "nodes_copied_in_new=%d " 537 "nodes_copied_in_new=%d "
531 "nodes_promoted=%d " 538 "nodes_promoted=%d "
532 "promotion_ratio=%.1f%% " 539 "promotion_ratio=%.1f%% "
533 "average_survival_ratio=%.1f%% " 540 "average_survival_ratio=%.1f%% "
534 "promotion_rate=%.1f%% " 541 "promotion_rate=%.1f%% "
535 "semi_space_copy_rate=%.1f%% " 542 "semi_space_copy_rate=%.1f%% "
536 "new_space_allocation_throughput=%" V8_PTR_PREFIX 543 "new_space_allocation_throughput=%" V8_PTR_PREFIX
537 "d " 544 "d "
538 "context_disposal_rate=%.1f\n", 545 "context_disposal_rate=%.1f "
546 "compaction_speed=%" V8_PTR_PREFIX "d\n",
539 heap_->isolate()->time_millis_since_init(), duration, 547 heap_->isolate()->time_millis_since_init(), duration,
540 spent_in_mutator, current_.TypeName(true), 548 spent_in_mutator, current_.TypeName(true),
541 current_.reduce_memory, current_.scopes[Scope::EXTERNAL], 549 current_.reduce_memory, current_.scopes[Scope::EXTERNAL],
542 current_.scopes[Scope::MC_MARK], 550 current_.scopes[Scope::MC_MARK],
543 current_.scopes[Scope::MC_MARK_FINISH_INCREMENTAL], 551 current_.scopes[Scope::MC_MARK_FINISH_INCREMENTAL],
544 current_.scopes[Scope::MC_MARK_PREPARE_CODE_FLUSH], 552 current_.scopes[Scope::MC_MARK_PREPARE_CODE_FLUSH],
545 current_.scopes[Scope::MC_MARK_ROOT], 553 current_.scopes[Scope::MC_MARK_ROOT],
546 current_.scopes[Scope::MC_MARK_TOPOPT], 554 current_.scopes[Scope::MC_MARK_TOPOPT],
547 current_.scopes[Scope::MC_MARK_RETAIN_MAPS], 555 current_.scopes[Scope::MC_MARK_RETAIN_MAPS],
548 current_.scopes[Scope::MC_MARK_WEAK_CLOSURE], 556 current_.scopes[Scope::MC_MARK_WEAK_CLOSURE],
(...skipping 29 matching lines...) Expand all
578 IncrementalMarkingSpeedInBytesPerMillisecond(), 586 IncrementalMarkingSpeedInBytesPerMillisecond(),
579 current_.start_object_size, current_.end_object_size, 587 current_.start_object_size, current_.end_object_size,
580 current_.start_holes_size, current_.end_holes_size, 588 current_.start_holes_size, current_.end_holes_size,
581 allocated_since_last_gc, heap_->promoted_objects_size(), 589 allocated_since_last_gc, heap_->promoted_objects_size(),
582 heap_->semi_space_copied_object_size(), 590 heap_->semi_space_copied_object_size(),
583 heap_->nodes_died_in_new_space_, 591 heap_->nodes_died_in_new_space_,
584 heap_->nodes_copied_in_new_space_, heap_->nodes_promoted_, 592 heap_->nodes_copied_in_new_space_, heap_->nodes_promoted_,
585 heap_->promotion_ratio_, AverageSurvivalRatio(), 593 heap_->promotion_ratio_, AverageSurvivalRatio(),
586 heap_->promotion_rate_, heap_->semi_space_copied_rate_, 594 heap_->promotion_rate_, heap_->semi_space_copied_rate_,
587 NewSpaceAllocationThroughputInBytesPerMillisecond(), 595 NewSpaceAllocationThroughputInBytesPerMillisecond(),
588 ContextDisposalRateInMilliseconds()); 596 ContextDisposalRateInMilliseconds(),
597 CompactionSpeedInBytesPerMillisecond());
589 break; 598 break;
590 case Event::START: 599 case Event::START:
591 break; 600 break;
592 default: 601 default:
593 UNREACHABLE(); 602 UNREACHABLE();
594 } 603 }
595 } 604 }
596 605
597 606
598 double GCTracer::MeanDuration(const EventBuffer& events) const { 607 double GCTracer::MeanDuration(const EventBuffer& events) const {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 durations += iter->end_time - iter->start_time; 708 durations += iter->end_time - iter->start_time;
700 ++iter; 709 ++iter;
701 } 710 }
702 711
703 if (durations == 0.0) return 0; 712 if (durations == 0.0) return 0;
704 // Make sure the result is at least 1. 713 // Make sure the result is at least 1.
705 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); 714 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1);
706 } 715 }
707 716
708 717
718 intptr_t GCTracer::CompactionSpeedInBytesPerMillisecond() const {
719 if (compaction_events_.size() < kRingBufferMaxSize) return 0.0;
720 intptr_t bytes = 0;
721 double durations = 0.0;
722 CompactionEventBuffer::const_iterator iter = compaction_events_.begin();
723 while (iter != compaction_events_.end()) {
724 bytes += iter->live_bytes_compacted;
725 durations += iter->duration;
726 ++iter;
727 }
728
729 if (durations == 0.0) return 0;
730 // Make sure the result is at least 1.
731 return Max<intptr_t>(static_cast<intptr_t>(bytes / durations + 0.5), 1);
732 }
733
734
709 intptr_t GCTracer::MarkCompactSpeedInBytesPerMillisecond() const { 735 intptr_t GCTracer::MarkCompactSpeedInBytesPerMillisecond() const {
710 intptr_t bytes = 0; 736 intptr_t bytes = 0;
711 double durations = 0.0; 737 double durations = 0.0;
712 EventBuffer::const_iterator iter = mark_compactor_events_.begin(); 738 EventBuffer::const_iterator iter = mark_compactor_events_.begin();
713 while (iter != mark_compactor_events_.end()) { 739 while (iter != mark_compactor_events_.end()) {
714 bytes += iter->start_object_size; 740 bytes += iter->start_object_size;
715 durations += iter->end_time - iter->start_time; 741 durations += iter->end_time - iter->start_time;
716 ++iter; 742 ++iter;
717 } 743 }
718 744
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 877
852 878
853 bool GCTracer::SurvivalEventsRecorded() const { 879 bool GCTracer::SurvivalEventsRecorded() const {
854 return survival_events_.size() > 0; 880 return survival_events_.size() > 0;
855 } 881 }
856 882
857 883
858 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } 884 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
859 } // namespace internal 885 } // namespace internal
860 } // namespace v8 886 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698