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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Default constructor leaves the event uninitialized. | 157 // Default constructor leaves the event uninitialized. |
158 ContextDisposalEvent() {} | 158 ContextDisposalEvent() {} |
159 | 159 |
160 explicit ContextDisposalEvent(double time); | 160 explicit ContextDisposalEvent(double time); |
161 | 161 |
162 // Time when context disposal event happened. | 162 // Time when context disposal event happened. |
163 double time_; | 163 double time_; |
164 }; | 164 }; |
165 | 165 |
166 | 166 |
167 class SurvivalEvent { | 167 class PromotionEvent { |
168 public: | 168 public: |
169 // Default constructor leaves the event uninitialized. | 169 // Default constructor leaves the event uninitialized. |
170 SurvivalEvent() {} | 170 PromotionEvent() {} |
171 | 171 |
172 explicit SurvivalEvent(double survival_rate); | 172 explicit PromotionEvent(double promotion_ratio); |
173 | 173 |
174 double survival_rate_; | 174 double promotion_ratio_; |
175 }; | 175 }; |
176 | 176 |
177 | 177 |
178 class Event { | 178 class Event { |
179 public: | 179 public: |
180 enum Type { | 180 enum Type { |
181 SCAVENGER = 0, | 181 SCAVENGER = 0, |
182 MARK_COMPACTOR = 1, | 182 MARK_COMPACTOR = 1, |
183 INCREMENTAL_MARK_COMPACTOR = 2, | 183 INCREMENTAL_MARK_COMPACTOR = 2, |
184 START = 3 | 184 START = 3 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 static const size_t kRingBufferMaxSize = 10; | 277 static const size_t kRingBufferMaxSize = 10; |
278 | 278 |
279 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; | 279 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; |
280 | 280 |
281 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; | 281 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; |
282 | 282 |
283 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> | 283 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> |
284 ContextDisposalEventBuffer; | 284 ContextDisposalEventBuffer; |
285 | 285 |
286 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; | 286 typedef RingBuffer<PromotionEvent, kRingBufferMaxSize> PromotionEventBuffer; |
287 | 287 |
288 explicit GCTracer(Heap* heap); | 288 explicit GCTracer(Heap* heap); |
289 | 289 |
290 // Start collecting data. | 290 // Start collecting data. |
291 void Start(GarbageCollector collector, const char* gc_reason, | 291 void Start(GarbageCollector collector, const char* gc_reason, |
292 const char* collector_reason); | 292 const char* collector_reason); |
293 | 293 |
294 // Stop collecting data and print results. | 294 // Stop collecting data and print results. |
295 void Stop(GarbageCollector collector); | 295 void Stop(GarbageCollector collector); |
296 | 296 |
297 // Log an allocation throughput event. | 297 // Log an allocation throughput event. |
298 void AddNewSpaceAllocationTime(double duration, intptr_t allocation_in_bytes); | 298 void AddNewSpaceAllocationTime(double duration, intptr_t allocation_in_bytes); |
299 | 299 |
300 void AddContextDisposalTime(double time); | 300 void AddContextDisposalTime(double time); |
301 | 301 |
302 void AddSurvivalRate(double survival_rate); | 302 void AddPromotionRatio(double promotion_ratio); |
303 | 303 |
304 // Log an incremental marking step. | 304 // Log an incremental marking step. |
305 void AddIncrementalMarkingStep(double duration, intptr_t bytes); | 305 void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
306 | 306 |
307 // Log time spent in marking. | 307 // Log time spent in marking. |
308 void AddMarkingTime(double duration) { | 308 void AddMarkingTime(double duration) { |
309 cumulative_marking_duration_ += duration; | 309 cumulative_marking_duration_ += duration; |
310 } | 310 } |
311 | 311 |
312 // Time spent in marking. | 312 // Time spent in marking. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Allocation throughput in the new space in bytes/millisecond. | 380 // Allocation throughput in the new space in bytes/millisecond. |
381 // Returns 0 if no events have been recorded. | 381 // Returns 0 if no events have been recorded. |
382 intptr_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; | 382 intptr_t NewSpaceAllocationThroughputInBytesPerMillisecond() const; |
383 | 383 |
384 // Computes the context disposal rate in milliseconds. It takes the time | 384 // Computes the context disposal rate in milliseconds. It takes the time |
385 // frame of the first recorded context disposal to the current time and | 385 // frame of the first recorded context disposal to the current time and |
386 // divides it by the number of recorded events. | 386 // divides it by the number of recorded events. |
387 // Returns 0 if no events have been recorded. | 387 // Returns 0 if no events have been recorded. |
388 double ContextDisposalRateInMilliseconds() const; | 388 double ContextDisposalRateInMilliseconds() const; |
389 | 389 |
390 // Computes the average survival rate based on the last recorded survival | 390 // Computes the average promotion ratio based on the last recorded promotion |
391 // events. | 391 // events. |
392 // Returns 0 if no events have been recorded. | 392 // Returns 0 if no events have been recorded. |
393 double AverageSurvivalRate() const; | 393 double AveragePromotionRatio() const; |
394 | 394 |
395 // Returns true if at least one survival event was recorded. | 395 // Returns true if at least one survival event was recorded. |
396 bool SurvivalEventsRecorded() const; | 396 bool SurvivalEventsRecorded() const; |
397 | 397 |
398 // Discard all recorded survival events. | 398 // Discard all recorded survival events. |
399 void ResetSurvivalEvents(); | 399 void ResetSurvivalEvents(); |
400 | 400 |
401 private: | 401 private: |
402 // Print one detailed trace line in name=value format. | 402 // Print one detailed trace line in name=value format. |
403 // TODO(ernstm): Move to Heap. | 403 // TODO(ernstm): Move to Heap. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 // RingBuffers for INCREMENTAL_MARK_COMPACTOR events. | 445 // RingBuffers for INCREMENTAL_MARK_COMPACTOR events. |
446 EventBuffer incremental_mark_compactor_events_; | 446 EventBuffer incremental_mark_compactor_events_; |
447 | 447 |
448 // RingBuffer for allocation events. | 448 // RingBuffer for allocation events. |
449 AllocationEventBuffer allocation_events_; | 449 AllocationEventBuffer allocation_events_; |
450 | 450 |
451 // RingBuffer for context disposal events. | 451 // RingBuffer for context disposal events. |
452 ContextDisposalEventBuffer context_disposal_events_; | 452 ContextDisposalEventBuffer context_disposal_events_; |
453 | 453 |
454 // RingBuffer for survival events. | 454 // RingBuffer for promotion events. |
455 SurvivalEventBuffer survival_events_; | 455 PromotionEventBuffer promotion_events_; |
456 | 456 |
457 // Cumulative number of incremental marking steps since creation of tracer. | 457 // Cumulative number of incremental marking steps since creation of tracer. |
458 int cumulative_incremental_marking_steps_; | 458 int cumulative_incremental_marking_steps_; |
459 | 459 |
460 // Cumulative size of incremental marking steps (in bytes) since creation of | 460 // Cumulative size of incremental marking steps (in bytes) since creation of |
461 // tracer. | 461 // tracer. |
462 intptr_t cumulative_incremental_marking_bytes_; | 462 intptr_t cumulative_incremental_marking_bytes_; |
463 | 463 |
464 // Cumulative duration of incremental marking steps since creation of tracer. | 464 // Cumulative duration of incremental marking steps since creation of tracer. |
465 double cumulative_incremental_marking_duration_; | 465 double cumulative_incremental_marking_duration_; |
(...skipping 24 matching lines...) Expand all Loading... |
490 | 490 |
491 // Counts how many tracers were started without stopping. | 491 // Counts how many tracers were started without stopping. |
492 int start_counter_; | 492 int start_counter_; |
493 | 493 |
494 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 494 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
495 }; | 495 }; |
496 } | 496 } |
497 } // namespace v8::internal | 497 } // namespace v8::internal |
498 | 498 |
499 #endif // V8_HEAP_GC_TRACER_H_ | 499 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |