| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 ++iter; | 724 ++iter; |
| 725 } | 725 } |
| 726 | 726 |
| 727 if (durations == 0.0) return 0; | 727 if (durations == 0.0) return 0; |
| 728 // Make sure the result is at least 1. | 728 // Make sure the result is at least 1. |
| 729 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); | 729 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); |
| 730 } | 730 } |
| 731 | 731 |
| 732 | 732 |
| 733 intptr_t GCTracer::CompactionSpeedInBytesPerMillisecond() const { | 733 intptr_t GCTracer::CompactionSpeedInBytesPerMillisecond() const { |
| 734 if (compaction_events_.size() < kRingBufferMaxSize) return 0; | 734 if (compaction_events_.size() == 0) return 0; |
| 735 intptr_t bytes = 0; | 735 intptr_t bytes = 0; |
| 736 double durations = 0.0; | 736 double durations = 0.0; |
| 737 CompactionEventBuffer::const_iterator iter = compaction_events_.begin(); | 737 CompactionEventBuffer::const_iterator iter = compaction_events_.begin(); |
| 738 while (iter != compaction_events_.end()) { | 738 while (iter != compaction_events_.end()) { |
| 739 bytes += iter->live_bytes_compacted; | 739 bytes += iter->live_bytes_compacted; |
| 740 durations += iter->duration; | 740 durations += iter->duration; |
| 741 ++iter; | 741 ++iter; |
| 742 } | 742 } |
| 743 | 743 |
| 744 if (durations == 0.0) return 0; | 744 if (durations == 0.0) return 0; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 892 |
| 893 | 893 |
| 894 bool GCTracer::SurvivalEventsRecorded() const { | 894 bool GCTracer::SurvivalEventsRecorded() const { |
| 895 return survival_events_.size() > 0; | 895 return survival_events_.size() > 0; |
| 896 } | 896 } |
| 897 | 897 |
| 898 | 898 |
| 899 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 899 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
| 900 } // namespace internal | 900 } // namespace internal |
| 901 } // namespace v8 | 901 } // namespace v8 |
| OLD | NEW |