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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 size_t new_space_counter_bytes, | 327 size_t new_space_counter_bytes, |
328 size_t old_generation_counter_bytes) { | 328 size_t old_generation_counter_bytes) { |
329 if (allocation_time_ms_ == 0) { | 329 if (allocation_time_ms_ == 0) { |
330 // It is the first sample. | 330 // It is the first sample. |
331 allocation_time_ms_ = current_ms; | 331 allocation_time_ms_ = current_ms; |
332 new_space_allocation_counter_bytes_ = new_space_counter_bytes; | 332 new_space_allocation_counter_bytes_ = new_space_counter_bytes; |
333 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; | 333 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; |
334 return; | 334 return; |
335 } | 335 } |
336 // This assumes that counters are unsigned integers so that the subtraction | 336 // This assumes that counters are unsigned integers so that the subtraction |
337 // below works even if the new counter is less then the old counter. | 337 // below works even if the new counter is less than the old counter. |
338 size_t new_space_allocated_bytes = | 338 size_t new_space_allocated_bytes = |
339 new_space_counter_bytes - new_space_allocation_counter_bytes_; | 339 new_space_counter_bytes - new_space_allocation_counter_bytes_; |
340 size_t old_generation_allocated_bytes = | 340 size_t old_generation_allocated_bytes = |
341 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; | 341 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; |
342 double duration = current_ms - allocation_time_ms_; | 342 double duration = current_ms - allocation_time_ms_; |
343 allocation_time_ms_ = current_ms; | 343 allocation_time_ms_ = current_ms; |
344 new_space_allocation_counter_bytes_ = new_space_counter_bytes; | 344 new_space_allocation_counter_bytes_ = new_space_counter_bytes; |
345 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; | 345 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; |
346 allocation_duration_since_gc_ += duration; | 346 allocation_duration_since_gc_ += duration; |
347 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; | 347 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 return sum / recorded_survival_ratios_.Count(); | 813 return sum / recorded_survival_ratios_.Count(); |
814 } | 814 } |
815 | 815 |
816 bool GCTracer::SurvivalEventsRecorded() const { | 816 bool GCTracer::SurvivalEventsRecorded() const { |
817 return recorded_survival_ratios_.Count() > 0; | 817 return recorded_survival_ratios_.Count() > 0; |
818 } | 818 } |
819 | 819 |
820 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } | 820 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } |
821 } // namespace internal | 821 } // namespace internal |
822 } // namespace v8 | 822 } // namespace v8 |
OLD | NEW |