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 #ifndef V8_HEAP_GC_TRACER_H_ | 5 #ifndef V8_HEAP_GC_TRACER_H_ |
6 #define V8_HEAP_GC_TRACER_H_ | 6 #define V8_HEAP_GC_TRACER_H_ |
7 | 7 |
8 #include "src/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/base/ring-buffer.h" | 10 #include "src/base/ring-buffer.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 F(SCAVENGER_WEAK) | 88 F(SCAVENGER_WEAK) |
89 | 89 |
90 #define TRACE_GC(tracer, scope_id) \ | 90 #define TRACE_GC(tracer, scope_id) \ |
91 GCTracer::Scope::ScopeId gc_tracer_scope_id(scope_id); \ | 91 GCTracer::Scope::ScopeId gc_tracer_scope_id(scope_id); \ |
92 GCTracer::Scope gc_tracer_scope(tracer, gc_tracer_scope_id); \ | 92 GCTracer::Scope gc_tracer_scope(tracer, gc_tracer_scope_id); \ |
93 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), \ | 93 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), \ |
94 GCTracer::Scope::Name(gc_tracer_scope_id)) | 94 GCTracer::Scope::Name(gc_tracer_scope_id)) |
95 | 95 |
96 // GCTracer collects and prints ONE line after each garbage collector | 96 // GCTracer collects and prints ONE line after each garbage collector |
97 // invocation IFF --trace_gc is used. | 97 // invocation IFF --trace_gc is used. |
98 class GCTracer { | 98 class V8_EXPORT_PRIVATE GCTracer { |
99 public: | 99 public: |
100 struct IncrementalMarkingInfos { | 100 struct IncrementalMarkingInfos { |
101 IncrementalMarkingInfos() : duration(0), longest_step(0), steps(0) {} | 101 IncrementalMarkingInfos() : duration(0), longest_step(0), steps(0) {} |
102 | 102 |
103 void Update(double duration) { | 103 void Update(double duration) { |
104 steps++; | 104 steps++; |
105 this->duration += duration; | 105 this->duration += duration; |
106 if (duration > longest_step) { | 106 if (duration > longest_step) { |
107 longest_step = duration; | 107 longest_step = duration; |
108 } | 108 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 base::RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; | 425 base::RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; |
426 base::RingBuffer<double> recorded_context_disposal_times_; | 426 base::RingBuffer<double> recorded_context_disposal_times_; |
427 base::RingBuffer<double> recorded_survival_ratios_; | 427 base::RingBuffer<double> recorded_survival_ratios_; |
428 | 428 |
429 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 429 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
430 }; | 430 }; |
431 } // namespace internal | 431 } // namespace internal |
432 } // namespace v8 | 432 } // namespace v8 |
433 | 433 |
434 #endif // V8_HEAP_GC_TRACER_H_ | 434 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |