Chromium Code Reviews

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

Issue 1825093002: [counters] adding runtime call timers for GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding gc timer Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 #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/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/counters.h"
9 #include "src/globals.h" 10 #include "src/globals.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 // A simple ring buffer class with maximum size known at compile time. 15 // A simple ring buffer class with maximum size known at compile time.
15 // The class only implements the functionality required in GCTracer. 16 // The class only implements the functionality required in GCTracer.
16 template <typename T, size_t MAX_SIZE> 17 template <typename T, size_t MAX_SIZE>
17 class RingBuffer { 18 class RingBuffer {
18 public: 19 public:
(...skipping 62 matching lines...)
81 T elements_[MAX_SIZE + 1]; 82 T elements_[MAX_SIZE + 1];
82 size_t begin_; 83 size_t begin_;
83 size_t end_; 84 size_t end_;
84 85
85 DISALLOW_COPY_AND_ASSIGN(RingBuffer); 86 DISALLOW_COPY_AND_ASSIGN(RingBuffer);
86 }; 87 };
87 88
88 89
89 enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; 90 enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
90 91
91
92 // GCTracer collects and prints ONE line after each garbage collector 92 // GCTracer collects and prints ONE line after each garbage collector
93 // invocation IFF --trace_gc is used. 93 // invocation IFF --trace_gc is used.
94 // TODO(ernstm): Unit tests. 94 // TODO(ernstm): Unit tests.
95 class GCTracer { 95 class GCTracer {
96 public: 96 public:
97 class Scope { 97 class Scope {
98 public: 98 public:
99 enum ScopeId { 99 enum ScopeId {
100 EXTERNAL_WEAK_GLOBAL_HANDLES, 100 EXTERNAL_WEAK_GLOBAL_HANDLES,
101 MC_CLEAR, 101 MC_CLEAR,
(...skipping 43 matching lines...)
145 NUMBER_OF_SCOPES 145 NUMBER_OF_SCOPES
146 }; 146 };
147 147
148 Scope(GCTracer* tracer, ScopeId scope); 148 Scope(GCTracer* tracer, ScopeId scope);
149 ~Scope(); 149 ~Scope();
150 150
151 private: 151 private:
152 GCTracer* tracer_; 152 GCTracer* tracer_;
153 ScopeId scope_; 153 ScopeId scope_;
154 double start_time_; 154 double start_time_;
155 RuntimeCallTimer timer_;
Camillo Bruni 2016/03/23 13:54:02 RuntimeCallTimer is a 3 word object.
155 156
156 DISALLOW_COPY_AND_ASSIGN(Scope); 157 DISALLOW_COPY_AND_ASSIGN(Scope);
157 }; 158 };
158 159
159 160
160 class AllocationEvent { 161 class AllocationEvent {
161 public: 162 public:
162 // Default constructor leaves the event uninitialized. 163 // Default constructor leaves the event uninitialized.
163 AllocationEvent() {} 164 AllocationEvent() {}
164 165
(...skipping 447 matching lines...)
612 613
613 // Counts how many tracers were started without stopping. 614 // Counts how many tracers were started without stopping.
614 int start_counter_; 615 int start_counter_;
615 616
616 DISALLOW_COPY_AND_ASSIGN(GCTracer); 617 DISALLOW_COPY_AND_ASSIGN(GCTracer);
617 }; 618 };
618 } // namespace internal 619 } // namespace internal
619 } // namespace v8 620 } // namespace v8
620 621
621 #endif // V8_HEAP_GC_TRACER_H_ 622 #endif // V8_HEAP_GC_TRACER_H_
OLDNEW
« no previous file with comments | « src/counters.cc ('k') | src/heap/gc-tracer.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine