| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; | 293 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; |
| 294 | 294 |
| 295 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; | 295 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; |
| 296 | 296 |
| 297 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> | 297 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
| 298 ContextDisposalEventBuffer; | 298 ContextDisposalEventBuffer; |
| 299 | 299 |
| 300 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; | 300 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; |
| 301 | 301 |
| 302 static const int kThroughputTimeFrameMs = 5000; |
| 303 |
| 302 explicit GCTracer(Heap* heap); | 304 explicit GCTracer(Heap* heap); |
| 303 | 305 |
| 304 // Start collecting data. | 306 // Start collecting data. |
| 305 void Start(GarbageCollector collector, const char* gc_reason, | 307 void Start(GarbageCollector collector, const char* gc_reason, |
| 306 const char* collector_reason); | 308 const char* collector_reason); |
| 307 | 309 |
| 308 // Stop collecting data and print results. | 310 // Stop collecting data and print results. |
| 309 void Stop(GarbageCollector collector); | 311 void Stop(GarbageCollector collector); |
| 310 | 312 |
| 311 // Sample and accumulate bytes allocated since the last GC. | 313 // Sample and accumulate bytes allocated since the last GC. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // last time_ms milliseconds. | 411 // last time_ms milliseconds. |
| 410 // Returns 0 if no allocation events have been recorded. | 412 // Returns 0 if no allocation events have been recorded. |
| 411 size_t OldGenerationAllocationThroughputInBytesPerMillisecond( | 413 size_t OldGenerationAllocationThroughputInBytesPerMillisecond( |
| 412 double time_ms = 0) const; | 414 double time_ms = 0) const; |
| 413 | 415 |
| 414 // Allocation throughput in heap in bytes/millisecond in the last time_ms | 416 // Allocation throughput in heap in bytes/millisecond in the last time_ms |
| 415 // milliseconds. | 417 // milliseconds. |
| 416 // Returns 0 if no allocation events have been recorded. | 418 // Returns 0 if no allocation events have been recorded. |
| 417 size_t AllocationThroughputInBytesPerMillisecond(double time_ms) const; | 419 size_t AllocationThroughputInBytesPerMillisecond(double time_ms) const; |
| 418 | 420 |
| 421 // Allocation throughput in heap in bytes/milliseconds in |
| 422 // the last five seconds. |
| 423 // Returns 0 if no allocation events have been recorded. |
| 424 size_t CurrentAllocationThroughputInBytesPerMillisecond() const; |
| 425 |
| 419 // Allocation throughput in old generation in bytes/milliseconds in | 426 // Allocation throughput in old generation in bytes/milliseconds in |
| 420 // the last five seconds. | 427 // the last five seconds. |
| 421 // Returns 0 if no allocation events have been recorded. | 428 // Returns 0 if no allocation events have been recorded. |
| 422 size_t CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() const; | 429 size_t CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() const; |
| 423 | 430 |
| 424 // Computes the context disposal rate in milliseconds. It takes the time | 431 // Computes the context disposal rate in milliseconds. It takes the time |
| 425 // frame of the first recorded context disposal to the current time and | 432 // frame of the first recorded context disposal to the current time and |
| 426 // divides it by the number of recorded events. | 433 // divides it by the number of recorded events. |
| 427 // Returns 0 if no events have been recorded. | 434 // Returns 0 if no events have been recorded. |
| 428 double ContextDisposalRateInMilliseconds() const; | 435 double ContextDisposalRateInMilliseconds() const; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 550 |
| 544 // Counts how many tracers were started without stopping. | 551 // Counts how many tracers were started without stopping. |
| 545 int start_counter_; | 552 int start_counter_; |
| 546 | 553 |
| 547 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 554 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 548 }; | 555 }; |
| 549 } | 556 } |
| 550 } // namespace v8::internal | 557 } // namespace v8::internal |
| 551 | 558 |
| 552 #endif // V8_HEAP_GC_TRACER_H_ | 559 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |