| 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/counters.h" | 10 #include "src/counters.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 class Event { | 187 class Event { |
| 188 public: | 188 public: |
| 189 enum Type { | 189 enum Type { |
| 190 SCAVENGER = 0, | 190 SCAVENGER = 0, |
| 191 MARK_COMPACTOR = 1, | 191 MARK_COMPACTOR = 1, |
| 192 INCREMENTAL_MARK_COMPACTOR = 2, | 192 INCREMENTAL_MARK_COMPACTOR = 2, |
| 193 START = 3 | 193 START = 3 |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 Event(Type type, const char* gc_reason, const char* collector_reason); | 196 Event(Type type, GarbageCollectionReason gc_reason, |
| 197 const char* collector_reason); |
| 197 | 198 |
| 198 // Returns a string describing the event type. | 199 // Returns a string describing the event type. |
| 199 const char* TypeName(bool short_name) const; | 200 const char* TypeName(bool short_name) const; |
| 200 | 201 |
| 201 // Type of event | 202 // Type of event |
| 202 Type type; | 203 Type type; |
| 203 | 204 |
| 204 const char* gc_reason; | 205 GarbageCollectionReason gc_reason; |
| 205 const char* collector_reason; | 206 const char* collector_reason; |
| 206 | 207 |
| 207 // Timestamp set in the constructor. | 208 // Timestamp set in the constructor. |
| 208 double start_time; | 209 double start_time; |
| 209 | 210 |
| 210 // Timestamp set in the destructor. | 211 // Timestamp set in the destructor. |
| 211 double end_time; | 212 double end_time; |
| 212 | 213 |
| 213 // Memory reduction flag set. | 214 // Memory reduction flag set. |
| 214 bool reduce_memory; | 215 bool reduce_memory; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Holds details for incremental marking scopes. | 265 // Holds details for incremental marking scopes. |
| 265 IncrementalMarkingInfos | 266 IncrementalMarkingInfos |
| 266 incremental_marking_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; | 267 incremental_marking_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; |
| 267 }; | 268 }; |
| 268 | 269 |
| 269 static const int kThroughputTimeFrameMs = 5000; | 270 static const int kThroughputTimeFrameMs = 5000; |
| 270 | 271 |
| 271 explicit GCTracer(Heap* heap); | 272 explicit GCTracer(Heap* heap); |
| 272 | 273 |
| 273 // Start collecting data. | 274 // Start collecting data. |
| 274 void Start(GarbageCollector collector, const char* gc_reason, | 275 void Start(GarbageCollector collector, GarbageCollectionReason gc_reason, |
| 275 const char* collector_reason); | 276 const char* collector_reason); |
| 276 | 277 |
| 277 // Stop collecting data and print results. | 278 // Stop collecting data and print results. |
| 278 void Stop(GarbageCollector collector); | 279 void Stop(GarbageCollector collector); |
| 279 | 280 |
| 280 // Sample and accumulate bytes allocated since the last GC. | 281 // Sample and accumulate bytes allocated since the last GC. |
| 281 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, | 282 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, |
| 282 size_t old_generation_counter_bytes); | 283 size_t old_generation_counter_bytes); |
| 283 | 284 |
| 284 // Log the accumulated new space allocation bytes. | 285 // Log the accumulated new space allocation bytes. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; | 510 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; |
| 510 RingBuffer<double> recorded_context_disposal_times_; | 511 RingBuffer<double> recorded_context_disposal_times_; |
| 511 RingBuffer<double> recorded_survival_ratios_; | 512 RingBuffer<double> recorded_survival_ratios_; |
| 512 | 513 |
| 513 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 514 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 514 }; | 515 }; |
| 515 } // namespace internal | 516 } // namespace internal |
| 516 } // namespace v8 | 517 } // namespace v8 |
| 517 | 518 |
| 518 #endif // V8_HEAP_GC_TRACER_H_ | 519 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |