| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; | 266 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; |
| 267 return; | 267 return; |
| 268 } | 268 } |
| 269 // This assumes that counters are unsigned integers so that the subtraction | 269 // This assumes that counters are unsigned integers so that the subtraction |
| 270 // below works even if the new counter is less then the old counter. | 270 // below works even if the new counter is less then the old counter. |
| 271 size_t new_space_allocated_bytes = | 271 size_t new_space_allocated_bytes = |
| 272 new_space_counter_bytes - new_space_allocation_counter_bytes_; | 272 new_space_counter_bytes - new_space_allocation_counter_bytes_; |
| 273 size_t old_generation_allocated_bytes = | 273 size_t old_generation_allocated_bytes = |
| 274 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; | 274 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; |
| 275 double duration = current_ms - allocation_time_ms_; | 275 double duration = current_ms - allocation_time_ms_; |
| 276 const double kMinDurationMs = 1; | 276 const double kMinDurationMs = 100; |
| 277 if (duration < kMinDurationMs) { | 277 if (duration < kMinDurationMs) { |
| 278 // Do not sample small durations to avoid precision errors. | 278 // Do not sample small durations to avoid precision errors. |
| 279 return; | 279 return; |
| 280 } | 280 } |
| 281 allocation_time_ms_ = current_ms; | 281 allocation_time_ms_ = current_ms; |
| 282 new_space_allocation_counter_bytes_ = new_space_counter_bytes; | 282 new_space_allocation_counter_bytes_ = new_space_counter_bytes; |
| 283 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; | 283 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; |
| 284 allocation_duration_since_gc_ += duration; | 284 allocation_duration_since_gc_ += duration; |
| 285 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; | 285 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; |
| 286 old_generation_allocation_in_bytes_since_gc_ += | 286 old_generation_allocation_in_bytes_since_gc_ += |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 690 |
| 691 | 691 |
| 692 bool GCTracer::SurvivalEventsRecorded() const { | 692 bool GCTracer::SurvivalEventsRecorded() const { |
| 693 return survival_events_.size() > 0; | 693 return survival_events_.size() > 0; |
| 694 } | 694 } |
| 695 | 695 |
| 696 | 696 |
| 697 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 697 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
| 698 } // namespace internal | 698 } // namespace internal |
| 699 } // namespace v8 | 699 } // namespace v8 |
| OLD | NEW |