Chromium Code Reviews| 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 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(Scope); | 135 DISALLOW_COPY_AND_ASSIGN(Scope); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 | 138 |
| 139 class AllocationEvent { | 139 class AllocationEvent { |
| 140 public: | 140 public: |
| 141 // Default constructor leaves the event uninitialized. | 141 // Default constructor leaves the event uninitialized. |
| 142 AllocationEvent() {} | 142 AllocationEvent() {} |
| 143 | 143 |
| 144 AllocationEvent(double duration, intptr_t allocation_in_bytes); | 144 AllocationEvent(double duration, size_t allocation_in_bytes); |
| 145 | 145 |
| 146 // Time spent in the mutator during the end of the last garbage collection | 146 // Time spent in the mutator during the end of the last sample to the |
| 147 // to the beginning of the next garbage collection. | 147 // beginning of the next sample. |
| 148 double duration_; | 148 double duration_; |
| 149 | 149 |
| 150 // Memory allocated in the new space during the end of the last garbage | 150 // Memory allocated in the new space during the end of the last sample |
| 151 // collection to the beginning of the next garbage collection. | 151 // to the beginning of the next sample |
| 152 intptr_t allocation_in_bytes_; | 152 size_t allocation_in_bytes_; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 | 155 |
| 156 class ContextDisposalEvent { | 156 class ContextDisposalEvent { |
| 157 public: | 157 public: |
| 158 // Default constructor leaves the event uninitialized. | 158 // Default constructor leaves the event uninitialized. |
| 159 ContextDisposalEvent() {} | 159 ContextDisposalEvent() {} |
| 160 | 160 |
| 161 explicit ContextDisposalEvent(double time); | 161 explicit ContextDisposalEvent(double time); |
| 162 | 162 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 double longest_incremental_marking_step; | 272 double longest_incremental_marking_step; |
| 273 | 273 |
| 274 // Amounts of time spent in different scopes during GC. | 274 // Amounts of time spent in different scopes during GC. |
| 275 double scopes[Scope::NUMBER_OF_SCOPES]; | 275 double scopes[Scope::NUMBER_OF_SCOPES]; |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 static const size_t kRingBufferMaxSize = 10; | 278 static const size_t kRingBufferMaxSize = 10; |
| 279 | 279 |
| 280 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; | 280 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; |
| 281 | 281 |
| 282 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; | 282 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; |
|
Hannes Payer (out of office)
2015/05/12 17:04:17
I am wondering about the size of the ring buffer.
ulan
2015/05/18 12:45:51
Adding a new allocation event for each idle notifi
| |
| 283 | 283 |
| 284 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> | 284 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
| 285 ContextDisposalEventBuffer; | 285 ContextDisposalEventBuffer; |
| 286 | 286 |
| 287 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; | 287 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; |
| 288 | 288 |
| 289 explicit GCTracer(Heap* heap); | 289 explicit GCTracer(Heap* heap); |
| 290 | 290 |
| 291 // Start collecting data. | 291 // Start collecting data. |
| 292 void Start(GarbageCollector collector, const char* gc_reason, | 292 void Start(GarbageCollector collector, const char* gc_reason, |
| 293 const char* collector_reason); | 293 const char* collector_reason); |
| 294 | 294 |
| 295 // Stop collecting data and print results. | 295 // Stop collecting data and print results. |
| 296 void Stop(GarbageCollector collector); | 296 void Stop(GarbageCollector collector); |
| 297 | 297 |
| 298 // Log an allocation throughput event. | 298 // Log an allocation throughput event. |
| 299 void AddNewSpaceAllocationTime(double duration, intptr_t allocation_in_bytes); | 299 void SampleNewSpaceAllocation(double current_ms, size_t counter_bytes); |
| 300 | 300 |
| 301 void AddContextDisposalTime(double time); | 301 void AddContextDisposalTime(double time); |
| 302 | 302 |
| 303 void AddSurvivalRatio(double survival_ratio); | 303 void AddSurvivalRatio(double survival_ratio); |
| 304 | 304 |
| 305 // Log an incremental marking step. | 305 // Log an incremental marking step. |
| 306 void AddIncrementalMarkingStep(double duration, intptr_t bytes); | 306 void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
| 307 | 307 |
| 308 // Log time spent in marking. | 308 // Log time spent in marking. |
| 309 void AddMarkingTime(double duration) { | 309 void AddMarkingTime(double duration) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 // Returns 0 if no events have been recorded. | 373 // Returns 0 if no events have been recorded. |
| 374 intptr_t MarkCompactSpeedInBytesPerMillisecond() const; | 374 intptr_t MarkCompactSpeedInBytesPerMillisecond() const; |
| 375 | 375 |
| 376 // Compute the average incremental mark-sweep finalize speed in | 376 // Compute the average incremental mark-sweep finalize speed in |
| 377 // bytes/millisecond. | 377 // bytes/millisecond. |
| 378 // Returns 0 if no events have been recorded. | 378 // Returns 0 if no events have been recorded. |
| 379 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; | 379 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; |
| 380 | 380 |
| 381 // Allocation throughput in the new space in bytes/millisecond. | 381 // Allocation throughput in the new space in bytes/millisecond. |
| 382 // Returns 0 if no events have been recorded. | 382 // Returns 0 if no events have been recorded. |
| 383 intptr_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; | 383 size_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; |
| 384 | 384 |
| 385 // Computes the context disposal rate in milliseconds. It takes the time | 385 // Computes the context disposal rate in milliseconds. It takes the time |
| 386 // frame of the first recorded context disposal to the current time and | 386 // frame of the first recorded context disposal to the current time and |
| 387 // divides it by the number of recorded events. | 387 // divides it by the number of recorded events. |
| 388 // Returns 0 if no events have been recorded. | 388 // Returns 0 if no events have been recorded. |
| 389 double ContextDisposalRateInMilliseconds() const; | 389 double ContextDisposalRateInMilliseconds() const; |
| 390 | 390 |
| 391 // Computes the average survival ratio based on the last recorded survival | 391 // Computes the average survival ratio based on the last recorded survival |
| 392 // events. | 392 // events. |
| 393 // Returns 0 if no events have been recorded. | 393 // Returns 0 if no events have been recorded. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 | 478 |
| 479 // Total sweeping time on the main thread. | 479 // Total sweeping time on the main thread. |
| 480 // This timer is precise when run with --print-cumulative-gc-stat | 480 // This timer is precise when run with --print-cumulative-gc-stat |
| 481 // TODO(hpayer): Account for sweeping time on sweeper threads. Add a | 481 // TODO(hpayer): Account for sweeping time on sweeper threads. Add a |
| 482 // different field for that. | 482 // different field for that. |
| 483 // TODO(hpayer): This timer right now just holds the sweeping time | 483 // TODO(hpayer): This timer right now just holds the sweeping time |
| 484 // of the initial atomic sweeping pause. Make sure that it accumulates | 484 // of the initial atomic sweeping pause. Make sure that it accumulates |
| 485 // all sweeping operations performed on the main thread. | 485 // all sweeping operations performed on the main thread. |
| 486 double cumulative_sweeping_duration_; | 486 double cumulative_sweeping_duration_; |
| 487 | 487 |
| 488 // Holds the new space top pointer recorded at the end of the last garbage | 488 double new_space_allocation_time_ms_; |
|
Hannes Payer (out of office)
2015/05/12 17:04:17
Please describe the added fields.
ulan
2015/05/18 12:45:51
Done.
| |
| 489 // collection. | 489 size_t new_space_allocation_counter_bytes_; |
| 490 intptr_t new_space_top_after_gc_; | |
| 491 | 490 |
| 492 // Counts how many tracers were started without stopping. | 491 // Counts how many tracers were started without stopping. |
| 493 int start_counter_; | 492 int start_counter_; |
| 494 | 493 |
| 495 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 494 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 496 }; | 495 }; |
| 497 } | 496 } |
| 498 } // namespace v8::internal | 497 } // namespace v8::internal |
| 499 | 498 |
| 500 #endif // V8_HEAP_GC_TRACER_H_ | 499 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |