| 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/counters.h" | |
| 10 #include "src/globals.h" | 9 #include "src/globals.h" |
| 11 | 10 |
| 12 namespace v8 { | 11 namespace v8 { |
| 13 namespace internal { | 12 namespace internal { |
| 14 | 13 |
| 15 // A simple ring buffer class with maximum size known at compile time. | 14 // A simple ring buffer class with maximum size known at compile time. |
| 16 // The class only implements the functionality required in GCTracer. | 15 // The class only implements the functionality required in GCTracer. |
| 17 template <typename T, size_t MAX_SIZE> | 16 template <typename T, size_t MAX_SIZE> |
| 18 class RingBuffer { | 17 class RingBuffer { |
| 19 public: | 18 public: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 T elements_[MAX_SIZE + 1]; | 81 T elements_[MAX_SIZE + 1]; |
| 83 size_t begin_; | 82 size_t begin_; |
| 84 size_t end_; | 83 size_t end_; |
| 85 | 84 |
| 86 DISALLOW_COPY_AND_ASSIGN(RingBuffer); | 85 DISALLOW_COPY_AND_ASSIGN(RingBuffer); |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 | 88 |
| 90 enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; | 89 enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; |
| 91 | 90 |
| 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...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_; | |
| 156 | 155 |
| 157 DISALLOW_COPY_AND_ASSIGN(Scope); | 156 DISALLOW_COPY_AND_ASSIGN(Scope); |
| 158 }; | 157 }; |
| 159 | 158 |
| 160 | 159 |
| 161 class AllocationEvent { | 160 class AllocationEvent { |
| 162 public: | 161 public: |
| 163 // Default constructor leaves the event uninitialized. | 162 // Default constructor leaves the event uninitialized. |
| 164 AllocationEvent() {} | 163 AllocationEvent() {} |
| 165 | 164 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // Accumulated duration and allocated bytes since the last GC. | 606 // Accumulated duration and allocated bytes since the last GC. |
| 608 double allocation_duration_since_gc_; | 607 double allocation_duration_since_gc_; |
| 609 size_t new_space_allocation_in_bytes_since_gc_; | 608 size_t new_space_allocation_in_bytes_since_gc_; |
| 610 size_t old_generation_allocation_in_bytes_since_gc_; | 609 size_t old_generation_allocation_in_bytes_since_gc_; |
| 611 | 610 |
| 612 double combined_mark_compact_speed_cache_; | 611 double combined_mark_compact_speed_cache_; |
| 613 | 612 |
| 614 // Counts how many tracers were started without stopping. | 613 // Counts how many tracers were started without stopping. |
| 615 int start_counter_; | 614 int start_counter_; |
| 616 | 615 |
| 617 // Separate timer used for --runtime_call_stats | |
| 618 RuntimeCallTimer timer_; | |
| 619 | |
| 620 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 616 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 621 }; | 617 }; |
| 622 } // namespace internal | 618 } // namespace internal |
| 623 } // namespace v8 | 619 } // namespace v8 |
| 624 | 620 |
| 625 #endif // V8_HEAP_GC_TRACER_H_ | 621 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |