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

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

Issue 1827563003: Revert of [counters] adding runtime call timers for GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « src/heap/gc-tracer.h ('k') | 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
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 static intptr_t CountTotalHolesSize(Heap* heap) { 14 static intptr_t CountTotalHolesSize(Heap* heap) {
15 intptr_t holes_size = 0; 15 intptr_t holes_size = 0;
16 OldSpaces spaces(heap); 16 OldSpaces spaces(heap);
17 for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) { 17 for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) {
18 holes_size += space->Waste() + space->Available(); 18 holes_size += space->Waste() + space->Available();
19 } 19 }
20 return holes_size; 20 return holes_size;
21 } 21 }
22 22
23 23
24 GCTracer::Scope::Scope(GCTracer* tracer, ScopeId scope) 24 GCTracer::Scope::Scope(GCTracer* tracer, ScopeId scope)
25 : tracer_(tracer), scope_(scope) { 25 : tracer_(tracer), scope_(scope) {
26 start_time_ = tracer_->heap_->MonotonicallyIncreasingTimeInMs(); 26 start_time_ = tracer_->heap_->MonotonicallyIncreasingTimeInMs();
27 // TODO(cbruni): remove once we fully moved to a trace-based system.
28 if (FLAG_runtime_call_stats) {
29 RuntimeCallStats* stats =
30 tracer_->heap_->isolate()->counters()->runtime_call_stats();
31 timer_.Initialize(&stats->GC, stats->current_timer());
32 stats->Enter(&timer_);
33 }
34 } 27 }
35 28
36 29
37 GCTracer::Scope::~Scope() { 30 GCTracer::Scope::~Scope() {
38 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned. 31 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned.
39 tracer_->current_.scopes[scope_] += 32 tracer_->current_.scopes[scope_] +=
40 tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_; 33 tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_;
41 // TODO(cbruni): remove once we fully moved to a trace-based system.
42 if (FLAG_runtime_call_stats) {
43 tracer_->heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_);
44 }
45 } 34 }
46 35
47 36
48 GCTracer::AllocationEvent::AllocationEvent(double duration, 37 GCTracer::AllocationEvent::AllocationEvent(double duration,
49 size_t allocation_in_bytes) { 38 size_t allocation_in_bytes) {
50 duration_ = duration; 39 duration_ = duration;
51 allocation_in_bytes_ = allocation_in_bytes; 40 allocation_in_bytes_ = allocation_in_bytes;
52 } 41 }
53 42
54 43
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 175
187 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) { 176 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) {
188 current_.scopes[i] = 0; 177 current_.scopes[i] = 0;
189 } 178 }
190 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); 179 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB);
191 int used_memory = static_cast<int>(current_.start_object_size / KB); 180 int used_memory = static_cast<int>(current_.start_object_size / KB);
192 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( 181 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
193 start_time, committed_memory); 182 start_time, committed_memory);
194 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( 183 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample(
195 start_time, used_memory); 184 start_time, used_memory);
196 // TODO(cbruni): remove once we fully moved to a trace-based system.
197 if (FLAG_runtime_call_stats) {
198 RuntimeCallStats* stats =
199 heap_->isolate()->counters()->runtime_call_stats();
200 timer_.Initialize(&stats->GC, stats->current_timer());
201 stats->Enter(&timer_);
202 }
203 } 185 }
204 186
205 187
206 void GCTracer::Stop(GarbageCollector collector) { 188 void GCTracer::Stop(GarbageCollector collector) {
207 start_counter_--; 189 start_counter_--;
208 if (start_counter_ != 0) { 190 if (start_counter_ != 0) {
209 Output("[Finished reentrant %s during %s.]\n", 191 Output("[Finished reentrant %s during %s.]\n",
210 collector == SCAVENGER ? "Scavenge" : "Mark-sweep", 192 collector == SCAVENGER ? "Scavenge" : "Mark-sweep",
211 current_.TypeName(false)); 193 current_.TypeName(false));
212 return; 194 return;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 else 274 else
293 Print(); 275 Print();
294 276
295 if (FLAG_trace_gc) { 277 if (FLAG_trace_gc) {
296 heap_->PrintShortHeapStatistics(); 278 heap_->PrintShortHeapStatistics();
297 } 279 }
298 280
299 longest_incremental_marking_finalization_step_ = 0.0; 281 longest_incremental_marking_finalization_step_ = 0.0;
300 cumulative_incremental_marking_finalization_steps_ = 0; 282 cumulative_incremental_marking_finalization_steps_ = 0;
301 cumulative_incremental_marking_finalization_duration_ = 0.0; 283 cumulative_incremental_marking_finalization_duration_ = 0.0;
302 // TODO(cbruni): remove once we fully moved to a trace-based system.
303 if (FLAG_runtime_call_stats) {
304 heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_);
305 }
306 } 284 }
307 285
308 286
309 void GCTracer::SampleAllocation(double current_ms, 287 void GCTracer::SampleAllocation(double current_ms,
310 size_t new_space_counter_bytes, 288 size_t new_space_counter_bytes,
311 size_t old_generation_counter_bytes) { 289 size_t old_generation_counter_bytes) {
312 if (allocation_time_ms_ == 0) { 290 if (allocation_time_ms_ == 0) {
313 // It is the first sample. 291 // It is the first sample.
314 allocation_time_ms_ = current_ms; 292 allocation_time_ms_ = current_ms;
315 new_space_allocation_counter_bytes_ = new_space_counter_bytes; 293 new_space_allocation_counter_bytes_ = new_space_counter_bytes;
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 920
943 921
944 bool GCTracer::SurvivalEventsRecorded() const { 922 bool GCTracer::SurvivalEventsRecorded() const {
945 return survival_events_.size() > 0; 923 return survival_events_.size() > 0;
946 } 924 }
947 925
948 926
949 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } 927 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
950 } // namespace internal 928 } // namespace internal
951 } // namespace v8 929 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698