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/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 SCAVENGER_CODE_FLUSH_CANDIDATES, | 136 SCAVENGER_CODE_FLUSH_CANDIDATES, |
137 SCAVENGER_OBJECT_GROUPS, | 137 SCAVENGER_OBJECT_GROUPS, |
138 SCAVENGER_OLD_TO_NEW_POINTERS, | 138 SCAVENGER_OLD_TO_NEW_POINTERS, |
139 SCAVENGER_ROOTS, | 139 SCAVENGER_ROOTS, |
140 SCAVENGER_SCAVENGE, | 140 SCAVENGER_SCAVENGE, |
141 SCAVENGER_SEMISPACE, | 141 SCAVENGER_SEMISPACE, |
142 SCAVENGER_WEAK, | 142 SCAVENGER_WEAK, |
143 NUMBER_OF_SCOPES | 143 NUMBER_OF_SCOPES |
144 }; | 144 }; |
145 | 145 |
146 Scope(GCTracer* tracer, ScopeId scope) : tracer_(tracer), scope_(scope) { | 146 Scope(GCTracer* tracer, ScopeId scope); |
147 start_time_ = base::OS::TimeCurrentMillis(); | 147 ~Scope(); |
148 } | |
149 | |
150 ~Scope() { | |
151 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned. | |
152 tracer_->current_.scopes[scope_] += | |
153 base::OS::TimeCurrentMillis() - start_time_; | |
154 } | |
155 | 148 |
156 private: | 149 private: |
157 GCTracer* tracer_; | 150 GCTracer* tracer_; |
158 ScopeId scope_; | 151 ScopeId scope_; |
159 double start_time_; | 152 double start_time_; |
160 | 153 |
161 DISALLOW_COPY_AND_ASSIGN(Scope); | 154 DISALLOW_COPY_AND_ASSIGN(Scope); |
162 }; | 155 }; |
163 | 156 |
164 | 157 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 584 |
592 // Counts how many tracers were started without stopping. | 585 // Counts how many tracers were started without stopping. |
593 int start_counter_; | 586 int start_counter_; |
594 | 587 |
595 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 588 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
596 }; | 589 }; |
597 } // namespace internal | 590 } // namespace internal |
598 } // namespace v8 | 591 } // namespace v8 |
599 | 592 |
600 #endif // V8_HEAP_GC_TRACER_H_ | 593 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |