| 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" |
| 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...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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...) 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_; |
| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // Accumulated duration and allocated bytes since the last GC. | 607 // Accumulated duration and allocated bytes since the last GC. |
| 607 double allocation_duration_since_gc_; | 608 double allocation_duration_since_gc_; |
| 608 size_t new_space_allocation_in_bytes_since_gc_; | 609 size_t new_space_allocation_in_bytes_since_gc_; |
| 609 size_t old_generation_allocation_in_bytes_since_gc_; | 610 size_t old_generation_allocation_in_bytes_since_gc_; |
| 610 | 611 |
| 611 double combined_mark_compact_speed_cache_; | 612 double combined_mark_compact_speed_cache_; |
| 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 |
| 617 // Separate timer used for --runtime_call_stats |
| 618 RuntimeCallTimer timer_; |
| 619 |
| 616 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 620 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 617 }; | 621 }; |
| 618 } // namespace internal | 622 } // namespace internal |
| 619 } // namespace v8 | 623 } // namespace v8 |
| 620 | 624 |
| 621 #endif // V8_HEAP_GC_TRACER_H_ | 625 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |