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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 allocation_duration_since_gc_(0.0), | 128 allocation_duration_since_gc_(0.0), |
129 new_space_allocation_in_bytes_since_gc_(0), | 129 new_space_allocation_in_bytes_since_gc_(0), |
130 old_generation_allocation_in_bytes_since_gc_(0), | 130 old_generation_allocation_in_bytes_since_gc_(0), |
131 combined_mark_compact_speed_cache_(0.0), | 131 combined_mark_compact_speed_cache_(0.0), |
132 start_counter_(0) { | 132 start_counter_(0) { |
133 current_ = Event(Event::START, NULL, NULL); | 133 current_ = Event(Event::START, NULL, NULL); |
134 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); | 134 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); |
135 previous_ = previous_incremental_mark_compactor_event_ = current_; | 135 previous_ = previous_incremental_mark_compactor_event_ = current_; |
136 } | 136 } |
137 | 137 |
| 138 void GCTracer::ResetForTesting() { |
| 139 cumulative_incremental_marking_steps_ = 0.0; |
| 140 cumulative_incremental_marking_bytes_ = 0.0; |
| 141 cumulative_incremental_marking_duration_ = 0.0; |
| 142 cumulative_pure_incremental_marking_duration_ = 0.0; |
| 143 longest_incremental_marking_step_ = 0.0; |
| 144 cumulative_incremental_marking_finalization_steps_ = 0.0; |
| 145 cumulative_incremental_marking_finalization_duration_ = 0.0; |
| 146 longest_incremental_marking_finalization_step_ = 0.0; |
| 147 cumulative_marking_duration_ = 0.0; |
| 148 cumulative_sweeping_duration_ = 0.0; |
| 149 allocation_time_ms_ = 0.0; |
| 150 new_space_allocation_counter_bytes_ = 0.0; |
| 151 old_generation_allocation_counter_bytes_ = 0.0; |
| 152 allocation_duration_since_gc_ = 0.0; |
| 153 new_space_allocation_in_bytes_since_gc_ = 0.0; |
| 154 old_generation_allocation_in_bytes_since_gc_ = 0.0; |
| 155 combined_mark_compact_speed_cache_ = 0.0; |
| 156 start_counter_ = 0; |
| 157 } |
138 | 158 |
139 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, | 159 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, |
140 const char* collector_reason) { | 160 const char* collector_reason) { |
141 start_counter_++; | 161 start_counter_++; |
142 if (start_counter_ != 1) return; | 162 if (start_counter_ != 1) return; |
143 | 163 |
144 previous_ = current_; | 164 previous_ = current_; |
145 double start_time = heap_->MonotonicallyIncreasingTimeInMs(); | 165 double start_time = heap_->MonotonicallyIncreasingTimeInMs(); |
146 SampleAllocation(start_time, heap_->NewSpaceAllocationCounter(), | 166 SampleAllocation(start_time, heap_->NewSpaceAllocationCounter(), |
147 heap_->OldGenerationAllocationCounter()); | 167 heap_->OldGenerationAllocationCounter()); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 return sum / recorded_survival_ratios_.Count(); | 813 return sum / recorded_survival_ratios_.Count(); |
794 } | 814 } |
795 | 815 |
796 bool GCTracer::SurvivalEventsRecorded() const { | 816 bool GCTracer::SurvivalEventsRecorded() const { |
797 return recorded_survival_ratios_.Count() > 0; | 817 return recorded_survival_ratios_.Count() > 0; |
798 } | 818 } |
799 | 819 |
800 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } | 820 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } |
801 } // namespace internal | 821 } // namespace internal |
802 } // namespace v8 | 822 } // namespace v8 |
OLD | NEW |