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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 612 |
613 if (durations == 0.0) return 0; | 613 if (durations == 0.0) return 0; |
614 // Make sure the result is at least 1. | 614 // Make sure the result is at least 1. |
615 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); | 615 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); |
616 } | 616 } |
617 | 617 |
618 | 618 |
619 double GCTracer::CombinedMarkCompactSpeedInBytesPerMillisecond() { | 619 double GCTracer::CombinedMarkCompactSpeedInBytesPerMillisecond() { |
620 if (combined_mark_compact_speed_cache_ > 0) | 620 if (combined_mark_compact_speed_cache_ > 0) |
621 return combined_mark_compact_speed_cache_; | 621 return combined_mark_compact_speed_cache_; |
622 const double kEpsilon = 1; | 622 const double kMinimumMarkingSpeed = 0.5; |
623 double speed1 = | 623 double speed1 = |
624 static_cast<double>(IncrementalMarkingSpeedInBytesPerMillisecond()); | 624 static_cast<double>(IncrementalMarkingSpeedInBytesPerMillisecond()); |
625 double speed2 = static_cast<double>( | 625 double speed2 = static_cast<double>( |
626 FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); | 626 FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); |
627 if (speed1 + speed2 < kEpsilon) { | 627 if (speed1 < kMinimumMarkingSpeed || speed2 < kMinimumMarkingSpeed) { |
628 // No data for the incremental marking speed. | 628 // No data for the incremental marking speed. |
629 // Return the non-incremental mark-compact speed. | 629 // Return the non-incremental mark-compact speed. |
630 combined_mark_compact_speed_cache_ = | 630 combined_mark_compact_speed_cache_ = |
631 static_cast<double>(MarkCompactSpeedInBytesPerMillisecond()); | 631 static_cast<double>(MarkCompactSpeedInBytesPerMillisecond()); |
632 } else { | 632 } else { |
633 // Combine the speed of incremental step and the speed of the final step. | 633 // Combine the speed of incremental step and the speed of the final step. |
634 // 1 / (1 / speed1 + 1 / speed2) = speed1 * speed2 / (speed1 + speed2). | 634 // 1 / (1 / speed1 + 1 / speed2) = speed1 * speed2 / (speed1 + speed2). |
635 combined_mark_compact_speed_cache_ = speed1 * speed2 / (speed1 + speed2); | 635 combined_mark_compact_speed_cache_ = speed1 * speed2 / (speed1 + speed2); |
636 } | 636 } |
637 return combined_mark_compact_speed_cache_; | 637 return combined_mark_compact_speed_cache_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 } | 678 } |
679 | 679 |
680 | 680 |
681 size_t GCTracer::AllocationThroughputInBytesPerMillisecond( | 681 size_t GCTracer::AllocationThroughputInBytesPerMillisecond( |
682 double time_ms) const { | 682 double time_ms) const { |
683 return NewSpaceAllocationThroughputInBytesPerMillisecond(time_ms) + | 683 return NewSpaceAllocationThroughputInBytesPerMillisecond(time_ms) + |
684 OldGenerationAllocationThroughputInBytesPerMillisecond(time_ms); | 684 OldGenerationAllocationThroughputInBytesPerMillisecond(time_ms); |
685 } | 685 } |
686 | 686 |
687 | 687 |
688 size_t GCTracer::CurrentAllocationThroughputInBytesPerMillisecond() const { | 688 size_t GCTracer::CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() |
| 689 const { |
689 static const double kThroughputTimeFrame = 5000; | 690 static const double kThroughputTimeFrame = 5000; |
690 return AllocationThroughputInBytesPerMillisecond(kThroughputTimeFrame); | 691 return OldGenerationAllocationThroughputInBytesPerMillisecond( |
| 692 kThroughputTimeFrame); |
691 } | 693 } |
692 | 694 |
693 | 695 |
694 double GCTracer::ContextDisposalRateInMilliseconds() const { | 696 double GCTracer::ContextDisposalRateInMilliseconds() const { |
695 if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0; | 697 if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0; |
696 | 698 |
697 double begin = base::OS::TimeCurrentMillis(); | 699 double begin = base::OS::TimeCurrentMillis(); |
698 double end = 0.0; | 700 double end = 0.0; |
699 ContextDisposalEventBuffer::const_iterator iter = | 701 ContextDisposalEventBuffer::const_iterator iter = |
700 context_disposal_events_.begin(); | 702 context_disposal_events_.begin(); |
(...skipping 21 matching lines...) Expand all Loading... |
722 | 724 |
723 | 725 |
724 bool GCTracer::SurvivalEventsRecorded() const { | 726 bool GCTracer::SurvivalEventsRecorded() const { |
725 return survival_events_.size() > 0; | 727 return survival_events_.size() > 0; |
726 } | 728 } |
727 | 729 |
728 | 730 |
729 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 731 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
730 } // namespace internal | 732 } // namespace internal |
731 } // namespace v8 | 733 } // namespace v8 |
OLD | NEW |