| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; | 285 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; |
| 286 | 286 |
| 287 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; | 287 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; |
| 288 | 288 |
| 289 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> | 289 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
| 290 ContextDisposalEventBuffer; | 290 ContextDisposalEventBuffer; |
| 291 | 291 |
| 292 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; | 292 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; |
| 293 | 293 |
| 294 static const int kThroughputTimeFrameMs = 5000; |
| 295 |
| 294 explicit GCTracer(Heap* heap); | 296 explicit GCTracer(Heap* heap); |
| 295 | 297 |
| 296 // Start collecting data. | 298 // Start collecting data. |
| 297 void Start(GarbageCollector collector, const char* gc_reason, | 299 void Start(GarbageCollector collector, const char* gc_reason, |
| 298 const char* collector_reason); | 300 const char* collector_reason); |
| 299 | 301 |
| 300 // Stop collecting data and print results. | 302 // Stop collecting data and print results. |
| 301 void Stop(GarbageCollector collector); | 303 void Stop(GarbageCollector collector); |
| 302 | 304 |
| 303 // Sample and accumulate bytes allocated since the last GC. | 305 // Sample and accumulate bytes allocated since the last GC. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // last time_ms milliseconds. | 403 // last time_ms milliseconds. |
| 402 // Returns 0 if no allocation events have been recorded. | 404 // Returns 0 if no allocation events have been recorded. |
| 403 size_t OldGenerationAllocationThroughputInBytesPerMillisecond( | 405 size_t OldGenerationAllocationThroughputInBytesPerMillisecond( |
| 404 double time_ms = 0) const; | 406 double time_ms = 0) const; |
| 405 | 407 |
| 406 // Allocation throughput in heap in bytes/millisecond in the last time_ms | 408 // Allocation throughput in heap in bytes/millisecond in the last time_ms |
| 407 // milliseconds. | 409 // milliseconds. |
| 408 // Returns 0 if no allocation events have been recorded. | 410 // Returns 0 if no allocation events have been recorded. |
| 409 size_t AllocationThroughputInBytesPerMillisecond(double time_ms) const; | 411 size_t AllocationThroughputInBytesPerMillisecond(double time_ms) const; |
| 410 | 412 |
| 413 // Allocation throughput in heap in bytes/milliseconds in |
| 414 // the last five seconds. |
| 415 // Returns 0 if no allocation events have been recorded. |
| 416 size_t CurrentAllocationThroughputInBytesPerMillisecond() const; |
| 417 |
| 411 // Allocation throughput in old generation in bytes/milliseconds in | 418 // Allocation throughput in old generation in bytes/milliseconds in |
| 412 // the last five seconds. | 419 // the last five seconds. |
| 413 // Returns 0 if no allocation events have been recorded. | 420 // Returns 0 if no allocation events have been recorded. |
| 414 size_t CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() const; | 421 size_t CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() const; |
| 415 | 422 |
| 416 // Computes the context disposal rate in milliseconds. It takes the time | 423 // Computes the context disposal rate in milliseconds. It takes the time |
| 417 // frame of the first recorded context disposal to the current time and | 424 // frame of the first recorded context disposal to the current time and |
| 418 // divides it by the number of recorded events. | 425 // divides it by the number of recorded events. |
| 419 // Returns 0 if no events have been recorded. | 426 // Returns 0 if no events have been recorded. |
| 420 double ContextDisposalRateInMilliseconds() const; | 427 double ContextDisposalRateInMilliseconds() const; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 542 |
| 536 // Counts how many tracers were started without stopping. | 543 // Counts how many tracers were started without stopping. |
| 537 int start_counter_; | 544 int start_counter_; |
| 538 | 545 |
| 539 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 546 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 540 }; | 547 }; |
| 541 } | 548 } |
| 542 } // namespace v8::internal | 549 } // namespace v8::internal |
| 543 | 550 |
| 544 #endif // V8_HEAP_GC_TRACER_H_ | 551 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |