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

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

Issue 2313193002: [Tracing] Fix runtime call stats tracing for GC. (Closed)
Patch Set: Remove duplicate runtime call stats in counters 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
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. 27 // TODO(cbruni): remove once we fully moved to a trace-based system.
28 if (FLAG_runtime_call_stats) { 28 if (TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() ||
29 FLAG_runtime_call_stats) {
29 RuntimeCallStats::Enter( 30 RuntimeCallStats::Enter(
30 tracer_->heap_->isolate()->counters()->runtime_call_stats(), &timer_, 31 tracer_->heap_->isolate()->counters()->runtime_call_stats(), &timer_,
31 &RuntimeCallStats::GC); 32 &RuntimeCallStats::GC);
32 } 33 }
33 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
34 } 34 }
35 35
36 GCTracer::Scope::~Scope() { 36 GCTracer::Scope::~Scope() {
37 tracer_->AddScopeSample( 37 tracer_->AddScopeSample(
38 scope_, tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_); 38 scope_, tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_);
39 // TODO(cbruni): remove once we fully moved to a trace-based system. 39 // TODO(cbruni): remove once we fully moved to a trace-based system.
40 if (FLAG_runtime_call_stats) { 40 if (TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() ||
41 FLAG_runtime_call_stats) {
41 RuntimeCallStats::Leave( 42 RuntimeCallStats::Leave(
42 tracer_->heap_->isolate()->counters()->runtime_call_stats(), &timer_); 43 tracer_->heap_->isolate()->counters()->runtime_call_stats(), &timer_);
43 } 44 }
44 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
45 } 45 }
46 46
47 const char* GCTracer::Scope::Name(ScopeId id) { 47 const char* GCTracer::Scope::Name(ScopeId id) {
48 #define CASE(scope) \ 48 #define CASE(scope) \
49 case Scope::scope: \ 49 case Scope::scope: \
50 return "V8.GC_" #scope; 50 return "V8.GC_" #scope;
51 switch (id) { 51 switch (id) {
52 TRACER_SCOPES(CASE) 52 TRACER_SCOPES(CASE)
53 case Scope::NUMBER_OF_SCOPES: 53 case Scope::NUMBER_OF_SCOPES:
54 break; 54 break;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 if (collector == SCAVENGER) { 211 if (collector == SCAVENGER) {
212 counters->scavenge_reason()->AddSample(static_cast<int>(gc_reason)); 212 counters->scavenge_reason()->AddSample(static_cast<int>(gc_reason));
213 } else { 213 } else {
214 counters->mark_compact_reason()->AddSample(static_cast<int>(gc_reason)); 214 counters->mark_compact_reason()->AddSample(static_cast<int>(gc_reason));
215 } 215 }
216 counters->aggregated_memory_heap_committed()->AddSample(start_time, 216 counters->aggregated_memory_heap_committed()->AddSample(start_time,
217 committed_memory); 217 committed_memory);
218 counters->aggregated_memory_heap_used()->AddSample(start_time, used_memory); 218 counters->aggregated_memory_heap_used()->AddSample(start_time, used_memory);
219 // TODO(cbruni): remove once we fully moved to a trace-based system. 219 // TODO(cbruni): remove once we fully moved to a trace-based system.
220 if (FLAG_runtime_call_stats) { 220 if (TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() ||
221 FLAG_runtime_call_stats) {
221 RuntimeCallStats::Enter(heap_->isolate()->counters()->runtime_call_stats(), 222 RuntimeCallStats::Enter(heap_->isolate()->counters()->runtime_call_stats(),
222 &timer_, &RuntimeCallStats::GC); 223 &timer_, &RuntimeCallStats::GC);
223 } 224 }
224 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
225 } 225 }
226 226
227 void GCTracer::MergeBaseline(const Event& baseline) { 227 void GCTracer::MergeBaseline(const Event& baseline) {
228 current_.incremental_marking_bytes = 228 current_.incremental_marking_bytes =
229 current_.cumulative_incremental_marking_bytes - 229 current_.cumulative_incremental_marking_bytes -
230 baseline.cumulative_incremental_marking_bytes; 230 baseline.cumulative_incremental_marking_bytes;
231 current_.pure_incremental_marking_duration = 231 current_.pure_incremental_marking_duration =
232 current_.cumulative_pure_incremental_marking_duration - 232 current_.cumulative_pure_incremental_marking_duration -
233 baseline.cumulative_pure_incremental_marking_duration; 233 baseline.cumulative_pure_incremental_marking_duration;
234 for (int i = Scope::FIRST_INCREMENTAL_SCOPE; 234 for (int i = Scope::FIRST_INCREMENTAL_SCOPE;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 PrintNVP(); 316 PrintNVP();
317 } else { 317 } else {
318 Print(); 318 Print();
319 } 319 }
320 320
321 if (FLAG_trace_gc) { 321 if (FLAG_trace_gc) {
322 heap_->PrintShortHeapStatistics(); 322 heap_->PrintShortHeapStatistics();
323 } 323 }
324 324
325 // TODO(cbruni): remove once we fully moved to a trace-based system. 325 // TODO(cbruni): remove once we fully moved to a trace-based system.
326 if (FLAG_runtime_call_stats) { 326 if (TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() ||
327 FLAG_runtime_call_stats) {
327 RuntimeCallStats::Leave(heap_->isolate()->counters()->runtime_call_stats(), 328 RuntimeCallStats::Leave(heap_->isolate()->counters()->runtime_call_stats(),
328 &timer_); 329 &timer_);
329 } 330 }
330 // TODO(lpy): Add a tracing equivalent for the runtime call stats.
331 } 331 }
332 332
333 333
334 void GCTracer::SampleAllocation(double current_ms, 334 void GCTracer::SampleAllocation(double current_ms,
335 size_t new_space_counter_bytes, 335 size_t new_space_counter_bytes,
336 size_t old_generation_counter_bytes) { 336 size_t old_generation_counter_bytes) {
337 if (allocation_time_ms_ == 0) { 337 if (allocation_time_ms_ == 0) {
338 // It is the first sample. 338 // It is the first sample.
339 allocation_time_ms_ = current_ms; 339 allocation_time_ms_ = current_ms;
340 new_space_allocation_counter_bytes_ = new_space_counter_bytes; 340 new_space_allocation_counter_bytes_ = new_space_counter_bytes;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 } 834 }
835 835
836 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } 836 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); }
837 837
838 void GCTracer::NotifyIncrementalMarkingStart() { 838 void GCTracer::NotifyIncrementalMarkingStart() {
839 incremental_marking_start_time_ = heap_->MonotonicallyIncreasingTimeInMs(); 839 incremental_marking_start_time_ = heap_->MonotonicallyIncreasingTimeInMs();
840 } 840 }
841 841
842 } // namespace internal 842 } // namespace internal
843 } // namespace v8 843 } // namespace v8
OLDNEW
« src/counters-inl.h ('K') | « src/counters-inl.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698