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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 current_ = | 157 current_ = |
158 Event(Event::INCREMENTAL_MARK_COMPACTOR, gc_reason, collector_reason); | 158 Event(Event::INCREMENTAL_MARK_COMPACTOR, gc_reason, collector_reason); |
159 } else { | 159 } else { |
160 current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason); | 160 current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 current_.reduce_memory = heap_->ShouldReduceMemory(); | 164 current_.reduce_memory = heap_->ShouldReduceMemory(); |
165 current_.start_time = start_time; | 165 current_.start_time = start_time; |
166 current_.start_object_size = heap_->SizeOfObjects(); | 166 current_.start_object_size = heap_->SizeOfObjects(); |
167 current_.start_memory_size = heap_->isolate()->memory_allocator()->Size(); | 167 current_.start_memory_size = heap_->memory_allocator()->Size(); |
168 current_.start_holes_size = CountTotalHolesSize(heap_); | 168 current_.start_holes_size = CountTotalHolesSize(heap_); |
169 current_.new_space_object_size = | 169 current_.new_space_object_size = |
170 heap_->new_space()->top() - heap_->new_space()->bottom(); | 170 heap_->new_space()->top() - heap_->new_space()->bottom(); |
171 | 171 |
172 current_.cumulative_incremental_marking_steps = | 172 current_.cumulative_incremental_marking_steps = |
173 cumulative_incremental_marking_steps_; | 173 cumulative_incremental_marking_steps_; |
174 current_.cumulative_incremental_marking_bytes = | 174 current_.cumulative_incremental_marking_bytes = |
175 cumulative_incremental_marking_bytes_; | 175 cumulative_incremental_marking_bytes_; |
176 current_.cumulative_incremental_marking_duration = | 176 current_.cumulative_incremental_marking_duration = |
177 cumulative_incremental_marking_duration_; | 177 cumulative_incremental_marking_duration_; |
(...skipping 29 matching lines...) Expand all Loading... |
207 } | 207 } |
208 | 208 |
209 DCHECK(start_counter_ >= 0); | 209 DCHECK(start_counter_ >= 0); |
210 DCHECK((collector == SCAVENGER && current_.type == Event::SCAVENGER) || | 210 DCHECK((collector == SCAVENGER && current_.type == Event::SCAVENGER) || |
211 (collector == MARK_COMPACTOR && | 211 (collector == MARK_COMPACTOR && |
212 (current_.type == Event::MARK_COMPACTOR || | 212 (current_.type == Event::MARK_COMPACTOR || |
213 current_.type == Event::INCREMENTAL_MARK_COMPACTOR))); | 213 current_.type == Event::INCREMENTAL_MARK_COMPACTOR))); |
214 | 214 |
215 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); | 215 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); |
216 current_.end_object_size = heap_->SizeOfObjects(); | 216 current_.end_object_size = heap_->SizeOfObjects(); |
217 current_.end_memory_size = heap_->isolate()->memory_allocator()->Size(); | 217 current_.end_memory_size = heap_->memory_allocator()->Size(); |
218 current_.end_holes_size = CountTotalHolesSize(heap_); | 218 current_.end_holes_size = CountTotalHolesSize(heap_); |
219 current_.survived_new_space_object_size = heap_->SurvivedNewSpaceObjectSize(); | 219 current_.survived_new_space_object_size = heap_->SurvivedNewSpaceObjectSize(); |
220 | 220 |
221 AddAllocation(current_.end_time); | 221 AddAllocation(current_.end_time); |
222 | 222 |
223 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); | 223 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); |
224 int used_memory = static_cast<int>(current_.end_object_size / KB); | 224 int used_memory = static_cast<int>(current_.end_object_size / KB); |
225 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( | 225 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( |
226 current_.end_time, committed_memory); | 226 current_.end_time, committed_memory); |
227 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( | 227 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 return sum / recorded_survival_ratios_.Count(); | 800 return sum / recorded_survival_ratios_.Count(); |
801 } | 801 } |
802 | 802 |
803 bool GCTracer::SurvivalEventsRecorded() const { | 803 bool GCTracer::SurvivalEventsRecorded() const { |
804 return recorded_survival_ratios_.Count() > 0; | 804 return recorded_survival_ratios_.Count() > 0; |
805 } | 805 } |
806 | 806 |
807 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } | 807 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } |
808 } // namespace internal | 808 } // namespace internal |
809 } // namespace v8 | 809 } // namespace v8 |
OLD | NEW |