Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: src/heap/gc-tracer.cc

Issue 2279193002: [heap] GCTracer: Properly reset all members for unittests (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 old_generation_allocation_counter_bytes_(0), 119 old_generation_allocation_counter_bytes_(0),
120 allocation_duration_since_gc_(0.0), 120 allocation_duration_since_gc_(0.0),
121 new_space_allocation_in_bytes_since_gc_(0), 121 new_space_allocation_in_bytes_since_gc_(0),
122 old_generation_allocation_in_bytes_since_gc_(0), 122 old_generation_allocation_in_bytes_since_gc_(0),
123 combined_mark_compact_speed_cache_(0.0), 123 combined_mark_compact_speed_cache_(0.0),
124 start_counter_(0) { 124 start_counter_(0) {
125 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); 125 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs();
126 } 126 }
127 127
128 void GCTracer::ResetForTesting() { 128 void GCTracer::ResetForTesting() {
129 current_ = Event(Event::START, NULL, NULL);
Michael Lippautz 2016/08/26 07:33:51 sorted by members declarations
130 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs();
131 previous_ = previous_incremental_mark_compactor_event_ = current_;
129 cumulative_incremental_marking_bytes_ = 0.0; 132 cumulative_incremental_marking_bytes_ = 0.0;
130 cumulative_incremental_marking_duration_ = 0.0; 133 cumulative_incremental_marking_duration_ = 0.0;
131 cumulative_pure_incremental_marking_duration_ = 0.0; 134 cumulative_pure_incremental_marking_duration_ = 0.0;
132 cumulative_marking_duration_ = 0.0; 135 cumulative_marking_duration_ = 0.0;
136 for (int i = 0; i < Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) {
137 incremental_marking_scopes_[i].cumulative_duration = 0.0;
138 incremental_marking_scopes_[i].steps = 0;
139 incremental_marking_scopes_[i].longest_step = 0.0;
140 }
133 cumulative_sweeping_duration_ = 0.0; 141 cumulative_sweeping_duration_ = 0.0;
134 allocation_time_ms_ = 0.0; 142 allocation_time_ms_ = 0.0;
135 new_space_allocation_counter_bytes_ = 0.0; 143 new_space_allocation_counter_bytes_ = 0.0;
136 old_generation_allocation_counter_bytes_ = 0.0; 144 old_generation_allocation_counter_bytes_ = 0.0;
137 allocation_duration_since_gc_ = 0.0; 145 allocation_duration_since_gc_ = 0.0;
138 new_space_allocation_in_bytes_since_gc_ = 0.0; 146 new_space_allocation_in_bytes_since_gc_ = 0.0;
139 old_generation_allocation_in_bytes_since_gc_ = 0.0; 147 old_generation_allocation_in_bytes_since_gc_ = 0.0;
140 combined_mark_compact_speed_cache_ = 0.0; 148 combined_mark_compact_speed_cache_ = 0.0;
149 recorded_scavenges_total_.Reset();
150 recorded_scavenges_survived_.Reset();
151 recorded_compactions_.Reset();
152 recorded_mark_compacts_.Reset();
153 recorded_incremental_mark_compacts_.Reset();
154 recorded_new_generation_allocations_.Reset();
155 recorded_old_generation_allocations_.Reset();
156 recorded_context_disposal_times_.Reset();
157 recorded_survival_ratios_.Reset();
141 start_counter_ = 0; 158 start_counter_ = 0;
142 for (int i = 0; i < Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) {
143 incremental_marking_scopes_[i].cumulative_duration = 0.0;
144 incremental_marking_scopes_[i].steps = 0;
145 incremental_marking_scopes_[i].longest_step = 0.0;
146 }
147 current_ = Event(Event::START, NULL, NULL);
148 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs();
149 previous_ = previous_incremental_mark_compactor_event_ = current_;
150 } 159 }
151 160
152 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, 161 void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
153 const char* collector_reason) { 162 const char* collector_reason) {
154 start_counter_++; 163 start_counter_++;
155 if (start_counter_ != 1) return; 164 if (start_counter_ != 1) return;
156 165
157 previous_ = current_; 166 previous_ = current_;
158 double start_time = heap_->MonotonicallyIncreasingTimeInMs(); 167 double start_time = heap_->MonotonicallyIncreasingTimeInMs();
159 SampleAllocation(start_time, heap_->NewSpaceAllocationCounter(), 168 SampleAllocation(start_time, heap_->NewSpaceAllocationCounter(),
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 return sum / recorded_survival_ratios_.Count(); 816 return sum / recorded_survival_ratios_.Count();
808 } 817 }
809 818
810 bool GCTracer::SurvivalEventsRecorded() const { 819 bool GCTracer::SurvivalEventsRecorded() const {
811 return recorded_survival_ratios_.Count() > 0; 820 return recorded_survival_ratios_.Count() > 0;
812 } 821 }
813 822
814 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } 823 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); }
815 } // namespace internal 824 } // namespace internal
816 } // namespace v8 825 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698