| 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 #include "src/counters.h" | 9 #include "src/counters.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 cumulative_sweeping_duration_ += duration; | 275 cumulative_sweeping_duration_ += duration; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Time spent in sweeping on main thread. | 278 // Time spent in sweeping on main thread. |
| 279 double cumulative_sweeping_duration() const { | 279 double cumulative_sweeping_duration() const { |
| 280 return cumulative_sweeping_duration_; | 280 return cumulative_sweeping_duration_; |
| 281 } | 281 } |
| 282 | 282 |
| 283 // Compute the average incremental marking speed in bytes/millisecond. | 283 // Compute the average incremental marking speed in bytes/millisecond. |
| 284 // Returns 0 if no events have been recorded. | 284 // Returns 0 if no events have been recorded. |
| 285 intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const; | 285 double IncrementalMarkingSpeedInBytesPerMillisecond() const; |
| 286 | 286 |
| 287 // Compute the average scavenge speed in bytes/millisecond. | 287 // Compute the average scavenge speed in bytes/millisecond. |
| 288 // Returns 0 if no events have been recorded. | 288 // Returns 0 if no events have been recorded. |
| 289 intptr_t ScavengeSpeedInBytesPerMillisecond( | 289 double ScavengeSpeedInBytesPerMillisecond( |
| 290 ScavengeSpeedMode mode = kForAllObjects) const; | 290 ScavengeSpeedMode mode = kForAllObjects) const; |
| 291 | 291 |
| 292 // Compute the average compaction speed in bytes/millisecond. | 292 // Compute the average compaction speed in bytes/millisecond. |
| 293 // Returns 0 if not enough events have been recorded. | 293 // Returns 0 if not enough events have been recorded. |
| 294 intptr_t CompactionSpeedInBytesPerMillisecond() const; | 294 double CompactionSpeedInBytesPerMillisecond() const; |
| 295 | 295 |
| 296 // Compute the average mark-sweep speed in bytes/millisecond. | 296 // Compute the average mark-sweep speed in bytes/millisecond. |
| 297 // Returns 0 if no events have been recorded. | 297 // Returns 0 if no events have been recorded. |
| 298 intptr_t MarkCompactSpeedInBytesPerMillisecond() const; | 298 double MarkCompactSpeedInBytesPerMillisecond() const; |
| 299 | 299 |
| 300 // Compute the average incremental mark-sweep finalize speed in | 300 // Compute the average incremental mark-sweep finalize speed in |
| 301 // bytes/millisecond. | 301 // bytes/millisecond. |
| 302 // Returns 0 if no events have been recorded. | 302 // Returns 0 if no events have been recorded. |
| 303 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; | 303 double FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; |
| 304 | 304 |
| 305 // Compute the overall mark compact speed including incremental steps | 305 // Compute the overall mark compact speed including incremental steps |
| 306 // and the final mark-compact step. | 306 // and the final mark-compact step. |
| 307 double CombinedMarkCompactSpeedInBytesPerMillisecond(); | 307 double CombinedMarkCompactSpeedInBytesPerMillisecond(); |
| 308 | 308 |
| 309 // Allocation throughput in the new space in bytes/millisecond. | 309 // Allocation throughput in the new space in bytes/millisecond. |
| 310 // Returns 0 if no allocation events have been recorded. | 310 // Returns 0 if no allocation events have been recorded. |
| 311 double NewSpaceAllocationThroughputInBytesPerMillisecond( | 311 double NewSpaceAllocationThroughputInBytesPerMillisecond( |
| 312 double time_ms = 0) const; | 312 double time_ms = 0) const; |
| 313 | 313 |
| 314 // Allocation throughput in the old generation in bytes/millisecond in the | 314 // Allocation throughput in the old generation in bytes/millisecond in the |
| 315 // last time_ms milliseconds. | 315 // last time_ms milliseconds. |
| 316 // Returns 0 if no allocation events have been recorded. | 316 // Returns 0 if no allocation events have been recorded. |
| 317 double OldGenerationAllocationThroughputInBytesPerMillisecond( | 317 double OldGenerationAllocationThroughputInBytesPerMillisecond( |
| 318 double time_ms = 0) const; | 318 double time_ms = 0) const; |
| 319 | 319 |
| 320 // Allocation throughput in heap in bytes/millisecond in the last time_ms | 320 // Allocation throughput in heap in bytes/millisecond in the last time_ms |
| 321 // milliseconds. | 321 // milliseconds. |
| 322 // Returns 0 if no allocation events have been recorded. | 322 // Returns 0 if no allocation events have been recorded. |
| 323 double AllocationThroughputInBytesPerMillisecond(double time_ms) const; | 323 double AllocationThroughputInBytesPerMillisecond(double time_ms) const; |
| 324 | 324 |
| 325 // Allocation throughput in heap in bytes/milliseconds in the last | 325 // Allocation throughput in heap in bytes/milliseconds in the last |
| 326 // kThroughputTimeFrameMs seconds. | 326 // kThroughputTimeFrameMs seconds. |
| 327 // Returns 0 if no allocation events have been recorded. | 327 // Returns 0 if no allocation events have been recorded. |
| 328 size_t CurrentAllocationThroughputInBytesPerMillisecond() const; | 328 double CurrentAllocationThroughputInBytesPerMillisecond() const; |
| 329 | 329 |
| 330 // Allocation throughput in old generation in bytes/milliseconds in the last | 330 // Allocation throughput in old generation in bytes/milliseconds in the last |
| 331 // kThroughputTimeFrameMs seconds. | 331 // kThroughputTimeFrameMs seconds. |
| 332 // Returns 0 if no allocation events have been recorded. | 332 // Returns 0 if no allocation events have been recorded. |
| 333 size_t CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() const; | 333 double CurrentOldGenerationAllocationThroughputInBytesPerMillisecond() const; |
| 334 | 334 |
| 335 // Computes the context disposal rate in milliseconds. It takes the time | 335 // Computes the context disposal rate in milliseconds. It takes the time |
| 336 // frame of the first recorded context disposal to the current time and | 336 // frame of the first recorded context disposal to the current time and |
| 337 // divides it by the number of recorded events. | 337 // divides it by the number of recorded events. |
| 338 // Returns 0 if no events have been recorded. | 338 // Returns 0 if no events have been recorded. |
| 339 double ContextDisposalRateInMilliseconds() const; | 339 double ContextDisposalRateInMilliseconds() const; |
| 340 | 340 |
| 341 // Computes the average survival ratio based on the last recorded survival | 341 // Computes the average survival ratio based on the last recorded survival |
| 342 // events. | 342 // events. |
| 343 // Returns 0 if no events have been recorded. | 343 // Returns 0 if no events have been recorded. |
| 344 double AverageSurvivalRatio() const; | 344 double AverageSurvivalRatio() const; |
| 345 | 345 |
| 346 // Returns true if at least one survival event was recorded. | 346 // Returns true if at least one survival event was recorded. |
| 347 bool SurvivalEventsRecorded() const; | 347 bool SurvivalEventsRecorded() const; |
| 348 | 348 |
| 349 // Discard all recorded survival events. | 349 // Discard all recorded survival events. |
| 350 void ResetSurvivalEvents(); | 350 void ResetSurvivalEvents(); |
| 351 | 351 |
| 352 // Returns the average speed of the events in the buffer. | 352 // Returns the average speed of the events in the buffer. |
| 353 // If the buffer is empty, the result is 0. | 353 // If the buffer is empty, the result is 0. |
| 354 // Otherwise, the result is between 1 byte/ms and 1 GB/ms. | 354 // Otherwise, the result is between 1 byte/ms and 1 GB/ms. |
| 355 static int AverageSpeed(const RingBuffer<BytesAndDuration>& buffer); | 355 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer); |
| 356 static int AverageSpeed(const RingBuffer<BytesAndDuration>& buffer, | 356 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer, |
| 357 const BytesAndDuration& initial, double time_ms); | 357 const BytesAndDuration& initial, double time_ms); |
| 358 | 358 |
| 359 private: | 359 private: |
| 360 // Print one detailed trace line in name=value format. | 360 // Print one detailed trace line in name=value format. |
| 361 // TODO(ernstm): Move to Heap. | 361 // TODO(ernstm): Move to Heap. |
| 362 void PrintNVP() const; | 362 void PrintNVP() const; |
| 363 | 363 |
| 364 // Print one trace line. | 364 // Print one trace line. |
| 365 // TODO(ernstm): Move to Heap. | 365 // TODO(ernstm): Move to Heap. |
| 366 void Print() const; | 366 void Print() const; |
| 367 | 367 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; | 474 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; |
| 475 RingBuffer<double> recorded_context_disposal_times_; | 475 RingBuffer<double> recorded_context_disposal_times_; |
| 476 RingBuffer<double> recorded_survival_ratios_; | 476 RingBuffer<double> recorded_survival_ratios_; |
| 477 | 477 |
| 478 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 478 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 479 }; | 479 }; |
| 480 } // namespace internal | 480 } // namespace internal |
| 481 } // namespace v8 | 481 } // namespace v8 |
| 482 | 482 |
| 483 #endif // V8_HEAP_GC_TRACER_H_ | 483 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |