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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/heap/gc-tracer.h" | 7 #include "src/heap/gc-tracer.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; | 270 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; |
271 return; | 271 return; |
272 } | 272 } |
273 // This assumes that counters are unsigned integers so that the subtraction | 273 // This assumes that counters are unsigned integers so that the subtraction |
274 // below works even if the new counter is less then the old counter. | 274 // below works even if the new counter is less then the old counter. |
275 size_t new_space_allocated_bytes = | 275 size_t new_space_allocated_bytes = |
276 new_space_counter_bytes - new_space_allocation_counter_bytes_; | 276 new_space_counter_bytes - new_space_allocation_counter_bytes_; |
277 size_t old_generation_allocated_bytes = | 277 size_t old_generation_allocated_bytes = |
278 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; | 278 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; |
279 double duration = current_ms - allocation_time_ms_; | 279 double duration = current_ms - allocation_time_ms_; |
280 const double kMinDurationMs = 100; | |
281 if (duration < kMinDurationMs) { | |
282 // Do not sample small durations to avoid precision errors. | |
283 return; | |
284 } | |
285 allocation_time_ms_ = current_ms; | 280 allocation_time_ms_ = current_ms; |
286 new_space_allocation_counter_bytes_ = new_space_counter_bytes; | 281 new_space_allocation_counter_bytes_ = new_space_counter_bytes; |
287 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; | 282 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; |
288 allocation_duration_since_gc_ += duration; | 283 allocation_duration_since_gc_ += duration; |
289 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; | 284 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; |
290 old_generation_allocation_in_bytes_since_gc_ += | 285 old_generation_allocation_in_bytes_since_gc_ += |
291 old_generation_allocated_bytes; | 286 old_generation_allocated_bytes; |
292 } | 287 } |
293 | 288 |
294 | 289 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 721 |
727 | 722 |
728 bool GCTracer::SurvivalEventsRecorded() const { | 723 bool GCTracer::SurvivalEventsRecorded() const { |
729 return survival_events_.size() > 0; | 724 return survival_events_.size() > 0; |
730 } | 725 } |
731 | 726 |
732 | 727 |
733 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 728 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
734 } // namespace internal | 729 } // namespace internal |
735 } // namespace v8 | 730 } // namespace v8 |
OLD | NEW |