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/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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 ++iter; | 711 ++iter; |
712 } | 712 } |
713 | 713 |
714 if (durations == 0.0) return 0; | 714 if (durations == 0.0) return 0; |
715 // Make sure the result is at least 1. | 715 // Make sure the result is at least 1. |
716 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); | 716 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); |
717 } | 717 } |
718 | 718 |
719 | 719 |
720 intptr_t GCTracer::CompactionSpeedInBytesPerMillisecond() const { | 720 intptr_t GCTracer::CompactionSpeedInBytesPerMillisecond() const { |
721 if (compaction_events_.size() < kRingBufferMaxSize) return 0.0; | 721 if (compaction_events_.size() < kRingBufferMaxSize) return 0; |
722 intptr_t bytes = 0; | 722 intptr_t bytes = 0; |
723 double durations = 0.0; | 723 double durations = 0.0; |
724 CompactionEventBuffer::const_iterator iter = compaction_events_.begin(); | 724 CompactionEventBuffer::const_iterator iter = compaction_events_.begin(); |
725 while (iter != compaction_events_.end()) { | 725 while (iter != compaction_events_.end()) { |
726 bytes += iter->live_bytes_compacted; | 726 bytes += iter->live_bytes_compacted; |
727 durations += iter->duration; | 727 durations += iter->duration; |
728 ++iter; | 728 ++iter; |
729 } | 729 } |
730 | 730 |
731 if (durations == 0.0) return 0; | 731 if (durations == 0.0) return 0; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 879 |
880 | 880 |
881 bool GCTracer::SurvivalEventsRecorded() const { | 881 bool GCTracer::SurvivalEventsRecorded() const { |
882 return survival_events_.size() > 0; | 882 return survival_events_.size() > 0; |
883 } | 883 } |
884 | 884 |
885 | 885 |
886 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 886 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
887 } // namespace internal | 887 } // namespace internal |
888 } // namespace v8 | 888 } // namespace v8 |
OLD | NEW |