| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 EventBuffer::const_iterator iter = events.begin(); | 690 EventBuffer::const_iterator iter = events.begin(); |
| 691 while (iter != events.end()) { | 691 while (iter != events.end()) { |
| 692 maximum = Max(iter->end_time - iter->start_time, maximum); | 692 maximum = Max(iter->end_time - iter->start_time, maximum); |
| 693 ++iter; | 693 ++iter; |
| 694 } | 694 } |
| 695 | 695 |
| 696 return maximum; | 696 return maximum; |
| 697 } | 697 } |
| 698 | 698 |
| 699 | 699 |
| 700 double GCTracer::MeanIncrementalMarkingDuration() const { | |
| 701 if (cumulative_incremental_marking_steps_ == 0) return 0.0; | |
| 702 | |
| 703 // We haven't completed an entire round of incremental marking, yet. | |
| 704 // Use data from GCTracer instead of data from event buffers. | |
| 705 if (incremental_mark_compactor_events_.empty()) { | |
| 706 return cumulative_incremental_marking_duration_ / | |
| 707 cumulative_incremental_marking_steps_; | |
| 708 } | |
| 709 | |
| 710 int steps = 0; | |
| 711 double durations = 0.0; | |
| 712 EventBuffer::const_iterator iter = incremental_mark_compactor_events_.begin(); | |
| 713 while (iter != incremental_mark_compactor_events_.end()) { | |
| 714 steps += iter->incremental_marking_steps; | |
| 715 durations += iter->incremental_marking_duration; | |
| 716 ++iter; | |
| 717 } | |
| 718 | |
| 719 if (steps == 0) return 0.0; | |
| 720 | |
| 721 return durations / steps; | |
| 722 } | |
| 723 | |
| 724 | |
| 725 double GCTracer::MaxIncrementalMarkingDuration() const { | |
| 726 // We haven't completed an entire round of incremental marking, yet. | |
| 727 // Use data from GCTracer instead of data from event buffers. | |
| 728 if (incremental_mark_compactor_events_.empty()) | |
| 729 return longest_incremental_marking_step_; | |
| 730 | |
| 731 double max_duration = 0.0; | |
| 732 EventBuffer::const_iterator iter = incremental_mark_compactor_events_.begin(); | |
| 733 while (iter != incremental_mark_compactor_events_.end()) | |
| 734 max_duration = Max(iter->longest_incremental_marking_step, max_duration); | |
| 735 | |
| 736 return max_duration; | |
| 737 } | |
| 738 | |
| 739 | |
| 740 intptr_t GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond() const { | 700 intptr_t GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond() const { |
| 741 if (cumulative_incremental_marking_duration_ == 0.0) return 0; | 701 if (cumulative_incremental_marking_duration_ == 0.0) return 0; |
| 742 | 702 |
| 743 // We haven't completed an entire round of incremental marking, yet. | 703 // We haven't completed an entire round of incremental marking, yet. |
| 744 // Use data from GCTracer instead of data from event buffers. | 704 // Use data from GCTracer instead of data from event buffers. |
| 745 if (incremental_mark_compactor_events_.empty()) { | 705 if (incremental_mark_compactor_events_.empty()) { |
| 746 return static_cast<intptr_t>(cumulative_incremental_marking_bytes_ / | 706 return static_cast<intptr_t>(cumulative_incremental_marking_bytes_ / |
| 747 cumulative_pure_incremental_marking_duration_); | 707 cumulative_pure_incremental_marking_duration_); |
| 748 } | 708 } |
| 749 | 709 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 902 |
| 943 | 903 |
| 944 bool GCTracer::SurvivalEventsRecorded() const { | 904 bool GCTracer::SurvivalEventsRecorded() const { |
| 945 return survival_events_.size() > 0; | 905 return survival_events_.size() > 0; |
| 946 } | 906 } |
| 947 | 907 |
| 948 | 908 |
| 949 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 909 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
| 950 } // namespace internal | 910 } // namespace internal |
| 951 } // namespace v8 | 911 } // namespace v8 |
| OLD | NEW |