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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Sample and accumulate bytes allocated since the last GC. | 298 // Sample and accumulate bytes allocated since the last GC. |
299 void SampleNewSpaceAllocation(double current_ms, size_t counter_bytes); | 299 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, |
| 300 size_t old_generation_counter_bytes); |
300 | 301 |
301 // Log the accumulated new space allocation bytes. | 302 // Log the accumulated new space allocation bytes. |
302 void AddNewSpaceAllocation(double current_ms); | 303 void AddAllocation(double current_ms); |
303 | 304 |
304 void AddContextDisposalTime(double time); | 305 void AddContextDisposalTime(double time); |
305 | 306 |
306 void AddSurvivalRatio(double survival_ratio); | 307 void AddSurvivalRatio(double survival_ratio); |
307 | 308 |
308 // Log an incremental marking step. | 309 // Log an incremental marking step. |
309 void AddIncrementalMarkingStep(double duration, intptr_t bytes); | 310 void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
310 | 311 |
311 // Log time spent in marking. | 312 // Log time spent in marking. |
312 void AddMarkingTime(double duration) { | 313 void AddMarkingTime(double duration) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 379 |
379 // Compute the average incremental mark-sweep finalize speed in | 380 // Compute the average incremental mark-sweep finalize speed in |
380 // bytes/millisecond. | 381 // bytes/millisecond. |
381 // Returns 0 if no events have been recorded. | 382 // Returns 0 if no events have been recorded. |
382 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; | 383 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; |
383 | 384 |
384 // Allocation throughput in the new space in bytes/millisecond. | 385 // Allocation throughput in the new space in bytes/millisecond. |
385 // Returns 0 if no allocation events have been recorded. | 386 // Returns 0 if no allocation events have been recorded. |
386 size_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; | 387 size_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; |
387 | 388 |
388 // Bytes allocated in new space in the specified time. | 389 // Bytes allocated in heap in the specified time. |
389 // Returns 0 if no allocation events have been recorded. | 390 // Returns 0 if no allocation events have been recorded. |
390 size_t NewSpaceAllocatedBytesInLast(double time_ms) const; | 391 size_t AllocatedBytesInLast(double time_ms) const; |
391 | 392 |
392 // Allocation throughput in the new space in bytes/milliseconds in | 393 // Allocation throughput in heap in bytes/milliseconds in |
393 // the last five seconds. | 394 // the last five seconds. |
394 // Returns 0 if no allocation events have been recorded. | 395 // Returns 0 if no allocation events have been recorded. |
395 size_t CurrentNewSpaceAllocationThroughputInBytesPerMillisecond() const; | 396 size_t CurrentAllocationThroughputInBytesPerMillisecond() const; |
396 | 397 |
397 // Computes the context disposal rate in milliseconds. It takes the time | 398 // Computes the context disposal rate in milliseconds. It takes the time |
398 // frame of the first recorded context disposal to the current time and | 399 // frame of the first recorded context disposal to the current time and |
399 // divides it by the number of recorded events. | 400 // divides it by the number of recorded events. |
400 // Returns 0 if no events have been recorded. | 401 // Returns 0 if no events have been recorded. |
401 double ContextDisposalRateInMilliseconds() const; | 402 double ContextDisposalRateInMilliseconds() const; |
402 | 403 |
403 // Computes the average survival ratio based on the last recorded survival | 404 // Computes the average survival ratio based on the last recorded survival |
404 // events. | 405 // events. |
405 // Returns 0 if no events have been recorded. | 406 // Returns 0 if no events have been recorded. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // RingBuffers for SCAVENGER events. | 453 // RingBuffers for SCAVENGER events. |
453 EventBuffer scavenger_events_; | 454 EventBuffer scavenger_events_; |
454 | 455 |
455 // RingBuffers for MARK_COMPACTOR events. | 456 // RingBuffers for MARK_COMPACTOR events. |
456 EventBuffer mark_compactor_events_; | 457 EventBuffer mark_compactor_events_; |
457 | 458 |
458 // RingBuffers for INCREMENTAL_MARK_COMPACTOR events. | 459 // RingBuffers for INCREMENTAL_MARK_COMPACTOR events. |
459 EventBuffer incremental_mark_compactor_events_; | 460 EventBuffer incremental_mark_compactor_events_; |
460 | 461 |
461 // RingBuffer for allocation events. | 462 // RingBuffer for allocation events. |
| 463 AllocationEventBuffer new_space_allocation_events_; |
462 AllocationEventBuffer allocation_events_; | 464 AllocationEventBuffer allocation_events_; |
463 | 465 |
464 // RingBuffer for context disposal events. | 466 // RingBuffer for context disposal events. |
465 ContextDisposalEventBuffer context_disposal_events_; | 467 ContextDisposalEventBuffer context_disposal_events_; |
466 | 468 |
467 // RingBuffer for survival events. | 469 // RingBuffer for survival events. |
468 SurvivalEventBuffer survival_events_; | 470 SurvivalEventBuffer survival_events_; |
469 | 471 |
470 // Cumulative number of incremental marking steps since creation of tracer. | 472 // Cumulative number of incremental marking steps since creation of tracer. |
471 int cumulative_incremental_marking_steps_; | 473 int cumulative_incremental_marking_steps_; |
(...skipping 19 matching lines...) Expand all Loading... |
491 // Total sweeping time on the main thread. | 493 // Total sweeping time on the main thread. |
492 // This timer is precise when run with --print-cumulative-gc-stat | 494 // This timer is precise when run with --print-cumulative-gc-stat |
493 // TODO(hpayer): Account for sweeping time on sweeper threads. Add a | 495 // TODO(hpayer): Account for sweeping time on sweeper threads. Add a |
494 // different field for that. | 496 // different field for that. |
495 // TODO(hpayer): This timer right now just holds the sweeping time | 497 // TODO(hpayer): This timer right now just holds the sweeping time |
496 // of the initial atomic sweeping pause. Make sure that it accumulates | 498 // of the initial atomic sweeping pause. Make sure that it accumulates |
497 // all sweeping operations performed on the main thread. | 499 // all sweeping operations performed on the main thread. |
498 double cumulative_sweeping_duration_; | 500 double cumulative_sweeping_duration_; |
499 | 501 |
500 // Timestamp and allocation counter at the last sampled allocation event. | 502 // Timestamp and allocation counter at the last sampled allocation event. |
501 double new_space_allocation_time_ms_; | 503 double allocation_time_ms_; |
502 size_t new_space_allocation_counter_bytes_; | 504 size_t new_space_allocation_counter_bytes_; |
| 505 size_t old_generation_allocation_counter_bytes_; |
503 | 506 |
504 // Accumulated duration and allocated bytes since the last GC. | 507 // Accumulated duration and allocated bytes since the last GC. |
505 double new_space_allocation_duration_since_gc_; | 508 double allocation_duration_since_gc_; |
506 size_t new_space_allocation_in_bytes_since_gc_; | 509 size_t new_space_allocation_in_bytes_since_gc_; |
| 510 size_t old_generation_allocation_in_bytes_since_gc_; |
507 | 511 |
508 // Counts how many tracers were started without stopping. | 512 // Counts how many tracers were started without stopping. |
509 int start_counter_; | 513 int start_counter_; |
510 | 514 |
511 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 515 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
512 }; | 516 }; |
513 } | 517 } |
514 } // namespace v8::internal | 518 } // namespace v8::internal |
515 | 519 |
516 #endif // V8_HEAP_GC_TRACER_H_ | 520 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |