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/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Timestamp set in the constructor. | 208 // Timestamp set in the constructor. |
209 double start_time; | 209 double start_time; |
210 | 210 |
211 // Timestamp set in the destructor. | 211 // Timestamp set in the destructor. |
212 double end_time; | 212 double end_time; |
213 | 213 |
214 // Memory reduction flag set. | 214 // Memory reduction flag set. |
215 bool reduce_memory; | 215 bool reduce_memory; |
216 | 216 |
217 // Size of objects in heap set in constructor. | 217 // Size of objects in heap set in constructor. |
218 intptr_t start_object_size; | 218 size_t start_object_size; |
219 | 219 |
220 // Size of objects in heap set in destructor. | 220 // Size of objects in heap set in destructor. |
221 intptr_t end_object_size; | 221 size_t end_object_size; |
222 | 222 |
223 // Size of memory allocated from OS set in constructor. | 223 // Size of memory allocated from OS set in constructor. |
224 size_t start_memory_size; | 224 size_t start_memory_size; |
225 | 225 |
226 // Size of memory allocated from OS set in destructor. | 226 // Size of memory allocated from OS set in destructor. |
227 size_t end_memory_size; | 227 size_t end_memory_size; |
228 | 228 |
229 // Total amount of space either wasted or contained in one of free lists | 229 // Total amount of space either wasted or contained in one of free lists |
230 // before the current GC. | 230 // before the current GC. |
231 intptr_t start_holes_size; | 231 size_t start_holes_size; |
232 | 232 |
233 // Total amount of space either wasted or contained in one of free lists | 233 // Total amount of space either wasted or contained in one of free lists |
234 // after the current GC. | 234 // after the current GC. |
235 intptr_t end_holes_size; | 235 size_t end_holes_size; |
236 | 236 |
237 // Size of new space objects in constructor. | 237 // Size of new space objects in constructor. |
238 intptr_t new_space_object_size; | 238 size_t new_space_object_size; |
239 | 239 |
240 // Size of survived new space objects in destructor. | 240 // Size of survived new space objects in destructor. |
241 intptr_t survived_new_space_object_size; | 241 size_t survived_new_space_object_size; |
242 | |
243 // Bytes marked since creation of tracer (value at start of event). | |
244 intptr_t cumulative_incremental_marking_bytes; | |
245 | 242 |
246 // Bytes marked incrementally for INCREMENTAL_MARK_COMPACTOR | 243 // Bytes marked incrementally for INCREMENTAL_MARK_COMPACTOR |
247 intptr_t incremental_marking_bytes; | 244 size_t incremental_marking_bytes; |
248 | 245 |
249 // Duration of incremental marking steps for INCREMENTAL_MARK_COMPACTOR. | 246 // Duration of incremental marking steps for INCREMENTAL_MARK_COMPACTOR. |
250 double incremental_marking_duration; | 247 double incremental_marking_duration; |
251 | 248 |
252 // Amounts of time spent in different scopes during GC. | 249 // Amounts of time spent in different scopes during GC. |
253 double scopes[Scope::NUMBER_OF_SCOPES]; | 250 double scopes[Scope::NUMBER_OF_SCOPES]; |
254 | 251 |
255 // Holds details for incremental marking scopes. | 252 // Holds details for incremental marking scopes. |
256 IncrementalMarkingInfos | 253 IncrementalMarkingInfos |
257 incremental_marking_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; | 254 incremental_marking_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; |
(...skipping 12 matching lines...) Expand all Loading... |
270 | 267 |
271 // Sample and accumulate bytes allocated since the last GC. | 268 // Sample and accumulate bytes allocated since the last GC. |
272 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, | 269 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, |
273 size_t old_generation_counter_bytes); | 270 size_t old_generation_counter_bytes); |
274 | 271 |
275 // Log the accumulated new space allocation bytes. | 272 // Log the accumulated new space allocation bytes. |
276 void AddAllocation(double current_ms); | 273 void AddAllocation(double current_ms); |
277 | 274 |
278 void AddContextDisposalTime(double time); | 275 void AddContextDisposalTime(double time); |
279 | 276 |
280 void AddCompactionEvent(double duration, intptr_t live_bytes_compacted); | 277 void AddCompactionEvent(double duration, size_t live_bytes_compacted); |
281 | 278 |
282 void AddSurvivalRatio(double survival_ratio); | 279 void AddSurvivalRatio(double survival_ratio); |
283 | 280 |
284 // Log an incremental marking step. | 281 // Log an incremental marking step. |
285 void AddIncrementalMarkingStep(double duration, intptr_t bytes); | 282 void AddIncrementalMarkingStep(double duration, size_t bytes); |
286 | 283 |
287 // Compute the average incremental marking speed in bytes/millisecond. | 284 // Compute the average incremental marking speed in bytes/millisecond. |
288 // Returns 0 if no events have been recorded. | 285 // Returns 0 if no events have been recorded. |
289 double IncrementalMarkingSpeedInBytesPerMillisecond() const; | 286 double IncrementalMarkingSpeedInBytesPerMillisecond() const; |
290 | 287 |
291 // Compute the average scavenge speed in bytes/millisecond. | 288 // Compute the average scavenge speed in bytes/millisecond. |
292 // Returns 0 if no events have been recorded. | 289 // Returns 0 if no events have been recorded. |
293 double ScavengeSpeedInBytesPerMillisecond( | 290 double ScavengeSpeedInBytesPerMillisecond( |
294 ScavengeSpeedMode mode = kForAllObjects) const; | 291 ScavengeSpeedMode mode = kForAllObjects) const; |
295 | 292 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 376 |
380 // Returns the average speed of the events in the buffer. | 377 // Returns the average speed of the events in the buffer. |
381 // If the buffer is empty, the result is 0. | 378 // If the buffer is empty, the result is 0. |
382 // Otherwise, the result is between 1 byte/ms and 1 GB/ms. | 379 // Otherwise, the result is between 1 byte/ms and 1 GB/ms. |
383 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer); | 380 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer); |
384 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer, | 381 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer, |
385 const BytesAndDuration& initial, double time_ms); | 382 const BytesAndDuration& initial, double time_ms); |
386 | 383 |
387 void ResetForTesting(); | 384 void ResetForTesting(); |
388 void ResetIncrementalMarkingCounters(); | 385 void ResetIncrementalMarkingCounters(); |
389 void RecordIncrementalMarkingSpeed(intptr_t bytes, double duration); | 386 void RecordIncrementalMarkingSpeed(size_t bytes, double duration); |
390 | 387 |
391 // Print one detailed trace line in name=value format. | 388 // Print one detailed trace line in name=value format. |
392 // TODO(ernstm): Move to Heap. | 389 // TODO(ernstm): Move to Heap. |
393 void PrintNVP() const; | 390 void PrintNVP() const; |
394 | 391 |
395 // Print one trace line. | 392 // Print one trace line. |
396 // TODO(ernstm): Move to Heap. | 393 // TODO(ernstm): Move to Heap. |
397 void Print() const; | 394 void Print() const; |
398 | 395 |
399 // Prints a line and also adds it to the heap's ring buffer so that | 396 // Prints a line and also adds it to the heap's ring buffer so that |
(...skipping 15 matching lines...) Expand all Loading... |
415 | 412 |
416 // Current tracer event. Populated during Start/Stop cycle. Valid after Stop() | 413 // Current tracer event. Populated during Start/Stop cycle. Valid after Stop() |
417 // has returned. | 414 // has returned. |
418 Event current_; | 415 Event current_; |
419 | 416 |
420 // Previous tracer event. | 417 // Previous tracer event. |
421 Event previous_; | 418 Event previous_; |
422 | 419 |
423 // Size of incremental marking steps (in bytes) accumulated since the end of | 420 // Size of incremental marking steps (in bytes) accumulated since the end of |
424 // the last mark compact GC. | 421 // the last mark compact GC. |
425 intptr_t incremental_marking_bytes_; | 422 size_t incremental_marking_bytes_; |
426 | 423 |
427 // Duration of incremental marking steps since the end of the last mark- | 424 // Duration of incremental marking steps since the end of the last mark- |
428 // compact event. | 425 // compact event. |
429 double incremental_marking_duration_; | 426 double incremental_marking_duration_; |
430 | 427 |
431 double incremental_marking_start_time_; | 428 double incremental_marking_start_time_; |
432 | 429 |
433 double recorded_incremental_marking_speed_; | 430 double recorded_incremental_marking_speed_; |
434 | 431 |
435 // Incremental scopes carry more information than just the duration. The infos | 432 // Incremental scopes carry more information than just the duration. The infos |
(...skipping 29 matching lines...) Expand all Loading... |
465 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; | 462 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; |
466 RingBuffer<double> recorded_context_disposal_times_; | 463 RingBuffer<double> recorded_context_disposal_times_; |
467 RingBuffer<double> recorded_survival_ratios_; | 464 RingBuffer<double> recorded_survival_ratios_; |
468 | 465 |
469 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 466 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
470 }; | 467 }; |
471 } // namespace internal | 468 } // namespace internal |
472 } // namespace v8 | 469 } // namespace v8 |
473 | 470 |
474 #endif // V8_HEAP_GC_TRACER_H_ | 471 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |