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" |
| 9 |
8 namespace v8 { | 10 namespace v8 { |
9 namespace internal { | 11 namespace internal { |
10 | 12 |
11 // A simple ring buffer class with maximum size known at compile time. | 13 // A simple ring buffer class with maximum size known at compile time. |
12 // The class only implements the functionality required in GCTracer. | 14 // The class only implements the functionality required in GCTracer. |
13 template <typename T, size_t MAX_SIZE> | 15 template <typename T, size_t MAX_SIZE> |
14 class RingBuffer { | 16 class RingBuffer { |
15 public: | 17 public: |
16 class const_iterator { | 18 class const_iterator { |
17 public: | 19 public: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 size_t begin_; | 76 size_t begin_; |
75 size_t end_; | 77 size_t end_; |
76 | 78 |
77 DISALLOW_COPY_AND_ASSIGN(RingBuffer); | 79 DISALLOW_COPY_AND_ASSIGN(RingBuffer); |
78 }; | 80 }; |
79 | 81 |
80 | 82 |
81 // GCTracer collects and prints ONE line after each garbage collector | 83 // GCTracer collects and prints ONE line after each garbage collector |
82 // invocation IFF --trace_gc is used. | 84 // invocation IFF --trace_gc is used. |
83 // TODO(ernstm): Unit tests. | 85 // TODO(ernstm): Unit tests. |
84 class GCTracer BASE_EMBEDDED { | 86 class GCTracer { |
85 public: | 87 public: |
86 class Scope BASE_EMBEDDED { | 88 class Scope { |
87 public: | 89 public: |
88 enum ScopeId { | 90 enum ScopeId { |
89 EXTERNAL, | 91 EXTERNAL, |
90 MC_MARK, | 92 MC_MARK, |
91 MC_SWEEP, | 93 MC_SWEEP, |
92 MC_SWEEP_NEWSPACE, | 94 MC_SWEEP_NEWSPACE, |
93 MC_SWEEP_OLDSPACE, | 95 MC_SWEEP_OLDSPACE, |
94 MC_SWEEP_CODE, | 96 MC_SWEEP_CODE, |
95 MC_SWEEP_CELL, | 97 MC_SWEEP_CELL, |
96 MC_SWEEP_MAP, | 98 MC_SWEEP_MAP, |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 double MaxIncrementalMarkingDuration() const; | 286 double MaxIncrementalMarkingDuration() const; |
285 | 287 |
286 // Compute the average incremental marking speed in bytes/millisecond. | 288 // Compute the average incremental marking speed in bytes/millisecond. |
287 // Returns 0 if no events have been recorded. | 289 // Returns 0 if no events have been recorded. |
288 intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const; | 290 intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const; |
289 | 291 |
290 // Compute the average scavenge speed in bytes/millisecond. | 292 // Compute the average scavenge speed in bytes/millisecond. |
291 // Returns 0 if no events have been recorded. | 293 // Returns 0 if no events have been recorded. |
292 intptr_t ScavengeSpeedInBytesPerMillisecond() const; | 294 intptr_t ScavengeSpeedInBytesPerMillisecond() const; |
293 | 295 |
| 296 // Compute the max mark-sweep speed in bytes/millisecond. |
| 297 // Returns 0 if no events have been recorded. |
| 298 intptr_t MarkCompactSpeedInBytesPerMillisecond() const; |
| 299 |
294 private: | 300 private: |
295 // Print one detailed trace line in name=value format. | 301 // Print one detailed trace line in name=value format. |
296 // TODO(ernstm): Move to Heap. | 302 // TODO(ernstm): Move to Heap. |
297 void PrintNVP() const; | 303 void PrintNVP() const; |
298 | 304 |
299 // Print one trace line. | 305 // Print one trace line. |
300 // TODO(ernstm): Move to Heap. | 306 // TODO(ernstm): Move to Heap. |
301 void Print() const; | 307 void Print() const; |
302 | 308 |
303 // Compute the mean duration of the events in the given ring buffer. | 309 // Compute the mean duration of the events in the given ring buffer. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // of the initial atomic sweeping pause. Make sure that it accumulates | 360 // of the initial atomic sweeping pause. Make sure that it accumulates |
355 // all sweeping operations performed on the main thread. | 361 // all sweeping operations performed on the main thread. |
356 double cumulative_sweeping_duration_; | 362 double cumulative_sweeping_duration_; |
357 | 363 |
358 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 364 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
359 }; | 365 }; |
360 } | 366 } |
361 } // namespace v8::internal | 367 } // namespace v8::internal |
362 | 368 |
363 #endif // V8_HEAP_GC_TRACER_H_ | 369 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |