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