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

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

Issue 1148633005: Uncommit and shrink semi-spaces only on low allocation rate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « src/heap/gc-tracer.h ('k') | src/heap/heap.h » ('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/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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 double durations = new_space_allocation_duration_since_gc_; 603 double durations = new_space_allocation_duration_since_gc_;
604 AllocationEventBuffer::const_iterator iter = allocation_events_.begin(); 604 AllocationEventBuffer::const_iterator iter = allocation_events_.begin();
605 const size_t max_bytes = static_cast<size_t>(-1); 605 const size_t max_bytes = static_cast<size_t>(-1);
606 while (iter != allocation_events_.end() && bytes < max_bytes - bytes && 606 while (iter != allocation_events_.end() && bytes < max_bytes - bytes &&
607 durations < time_ms) { 607 durations < time_ms) {
608 bytes += iter->allocation_in_bytes_; 608 bytes += iter->allocation_in_bytes_;
609 durations += iter->duration_; 609 durations += iter->duration_;
610 ++iter; 610 ++iter;
611 } 611 }
612 612
613 if (durations < time_ms) return 0; 613 if (durations == 0.0) return 0;
614 614
615 bytes = static_cast<size_t>(bytes * (time_ms / durations) + 0.5); 615 bytes = static_cast<size_t>(bytes * (time_ms / durations) + 0.5);
616 // Return at least 1 since 0 means "no data". 616 // Return at least 1 since 0 means "no data".
617 return std::max<size_t>(bytes, 1); 617 return std::max<size_t>(bytes, 1);
618 } 618 }
619 619
620 620
621 size_t GCTracer::CurrentNewSpaceAllocationThroughputInBytesPerMillisecond()
622 const {
623 static const double kThroughputTimeFrame = 5000;
624 size_t allocated_bytes = NewSpaceAllocatedBytesInLast(kThroughputTimeFrame);
625 if (allocated_bytes == 0) return 0;
626 return static_cast<size_t>((allocated_bytes / kThroughputTimeFrame) + 1);
627 }
628
629
621 double GCTracer::ContextDisposalRateInMilliseconds() const { 630 double GCTracer::ContextDisposalRateInMilliseconds() const {
622 if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0; 631 if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0;
623 632
624 double begin = base::OS::TimeCurrentMillis(); 633 double begin = base::OS::TimeCurrentMillis();
625 double end = 0.0; 634 double end = 0.0;
626 ContextDisposalEventBuffer::const_iterator iter = 635 ContextDisposalEventBuffer::const_iterator iter =
627 context_disposal_events_.begin(); 636 context_disposal_events_.begin();
628 while (iter != context_disposal_events_.end()) { 637 while (iter != context_disposal_events_.end()) {
629 end = iter->time_; 638 end = iter->time_;
630 ++iter; 639 ++iter;
(...skipping 18 matching lines...) Expand all
649 658
650 659
651 bool GCTracer::SurvivalEventsRecorded() const { 660 bool GCTracer::SurvivalEventsRecorded() const {
652 return survival_events_.size() > 0; 661 return survival_events_.size() > 0;
653 } 662 }
654 663
655 664
656 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } 665 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
657 } 666 }
658 } // namespace v8::internal 667 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698