Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: src/heap/gc-tracer.h

Issue 1410633005: [heap] Base number of compaction tasks on live memory and compaction speed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/gc-tracer.cc » ('j') | src/heap/mark-compact.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/globals.h" 9 #include "src/globals.h"
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Time spent in the mutator during the end of the last sample to the 171 // Time spent in the mutator during the end of the last sample to the
172 // beginning of the next sample. 172 // beginning of the next sample.
173 double duration_; 173 double duration_;
174 174
175 // Memory allocated in the new space during the end of the last sample 175 // Memory allocated in the new space during the end of the last sample
176 // to the beginning of the next sample 176 // to the beginning of the next sample
177 size_t allocation_in_bytes_; 177 size_t allocation_in_bytes_;
178 }; 178 };
179 179
180 180
181 class CompactionEvent {
182 public:
183 CompactionEvent() : duration(0), live_bytes_compacted(0) {}
184
185 CompactionEvent(double duration, intptr_t live_bytes_compacted)
186 : duration(duration), live_bytes_compacted(live_bytes_compacted) {}
187
188 double duration;
189 intptr_t live_bytes_compacted;
190 };
191
192
181 class ContextDisposalEvent { 193 class ContextDisposalEvent {
182 public: 194 public:
183 // Default constructor leaves the event uninitialized. 195 // Default constructor leaves the event uninitialized.
184 ContextDisposalEvent() {} 196 ContextDisposalEvent() {}
185 197
186 explicit ContextDisposalEvent(double time); 198 explicit ContextDisposalEvent(double time);
187 199
188 // Time when context disposal event happened. 200 // Time when context disposal event happened.
189 double time_; 201 double time_;
190 }; 202 };
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 319
308 static const size_t kRingBufferMaxSize = 10; 320 static const size_t kRingBufferMaxSize = 10;
309 321
310 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; 322 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer;
311 323
312 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer; 324 typedef RingBuffer<AllocationEvent, kRingBufferMaxSize> AllocationEventBuffer;
313 325
314 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize> 326 typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize>
315 ContextDisposalEventBuffer; 327 ContextDisposalEventBuffer;
316 328
329 typedef RingBuffer<CompactionEvent, kRingBufferMaxSize> CompactionEventBuffer;
330
317 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer; 331 typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer;
318 332
319 static const int kThroughputTimeFrameMs = 5000; 333 static const int kThroughputTimeFrameMs = 5000;
320 334
321 explicit GCTracer(Heap* heap); 335 explicit GCTracer(Heap* heap);
322 336
323 // Start collecting data. 337 // Start collecting data.
324 void Start(GarbageCollector collector, const char* gc_reason, 338 void Start(GarbageCollector collector, const char* gc_reason,
325 const char* collector_reason); 339 const char* collector_reason);
326 340
327 // Stop collecting data and print results. 341 // Stop collecting data and print results.
328 void Stop(GarbageCollector collector); 342 void Stop(GarbageCollector collector);
329 343
330 // Sample and accumulate bytes allocated since the last GC. 344 // Sample and accumulate bytes allocated since the last GC.
331 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, 345 void SampleAllocation(double current_ms, size_t new_space_counter_bytes,
332 size_t old_generation_counter_bytes); 346 size_t old_generation_counter_bytes);
333 347
334 // Log the accumulated new space allocation bytes. 348 // Log the accumulated new space allocation bytes.
335 void AddAllocation(double current_ms); 349 void AddAllocation(double current_ms);
336 350
337 void AddContextDisposalTime(double time); 351 void AddContextDisposalTime(double time);
338 352
353 void AddCompactionEvent(double duration, intptr_t live_bytes_compacted);
354
339 void AddSurvivalRatio(double survival_ratio); 355 void AddSurvivalRatio(double survival_ratio);
340 356
341 // Log an incremental marking step. 357 // Log an incremental marking step.
342 void AddIncrementalMarkingStep(double duration, intptr_t bytes); 358 void AddIncrementalMarkingStep(double duration, intptr_t bytes);
343 359
344 // Log time spent in marking. 360 // Log time spent in marking.
345 void AddMarkingTime(double duration) { 361 void AddMarkingTime(double duration) {
346 cumulative_marking_duration_ += duration; 362 cumulative_marking_duration_ += duration;
347 } 363 }
348 364
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 415
400 // Compute the average incremental marking speed in bytes/millisecond. 416 // Compute the average incremental marking speed in bytes/millisecond.
401 // Returns 0 if no events have been recorded. 417 // Returns 0 if no events have been recorded.
402 intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const; 418 intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const;
403 419
404 // Compute the average scavenge speed in bytes/millisecond. 420 // Compute the average scavenge speed in bytes/millisecond.
405 // Returns 0 if no events have been recorded. 421 // Returns 0 if no events have been recorded.
406 intptr_t ScavengeSpeedInBytesPerMillisecond( 422 intptr_t ScavengeSpeedInBytesPerMillisecond(
407 ScavengeSpeedMode mode = kForAllObjects) const; 423 ScavengeSpeedMode mode = kForAllObjects) const;
408 424
425 intptr_t CompactionSpeedInBytesPerMillisecond() const;
Hannes Payer (out of office) 2015/11/03 04:08:17 Add comment, like others.
Michael Lippautz 2015/11/03 20:57:42 Done.
426
409 // Compute the average mark-sweep speed in bytes/millisecond. 427 // Compute the average mark-sweep speed in bytes/millisecond.
410 // Returns 0 if no events have been recorded. 428 // Returns 0 if no events have been recorded.
411 intptr_t MarkCompactSpeedInBytesPerMillisecond() const; 429 intptr_t MarkCompactSpeedInBytesPerMillisecond() const;
412 430
413 // Compute the average incremental mark-sweep finalize speed in 431 // Compute the average incremental mark-sweep finalize speed in
414 // bytes/millisecond. 432 // bytes/millisecond.
415 // Returns 0 if no events have been recorded. 433 // Returns 0 if no events have been recorded.
416 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const; 434 intptr_t FinalIncrementalMarkCompactSpeedInBytesPerMillisecond() const;
417 435
418 // Compute the overall mark compact speed including incremental steps 436 // Compute the overall mark compact speed including incremental steps
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // RingBuffers for INCREMENTAL_MARK_COMPACTOR events. 531 // RingBuffers for INCREMENTAL_MARK_COMPACTOR events.
514 EventBuffer incremental_mark_compactor_events_; 532 EventBuffer incremental_mark_compactor_events_;
515 533
516 // RingBuffer for allocation events. 534 // RingBuffer for allocation events.
517 AllocationEventBuffer new_space_allocation_events_; 535 AllocationEventBuffer new_space_allocation_events_;
518 AllocationEventBuffer old_generation_allocation_events_; 536 AllocationEventBuffer old_generation_allocation_events_;
519 537
520 // RingBuffer for context disposal events. 538 // RingBuffer for context disposal events.
521 ContextDisposalEventBuffer context_disposal_events_; 539 ContextDisposalEventBuffer context_disposal_events_;
522 540
541 CompactionEventBuffer compaction_events_;
Hannes Payer (out of office) 2015/11/03 04:08:17 Comment.
Michael Lippautz 2015/11/03 20:57:42 Done.
542
523 // RingBuffer for survival events. 543 // RingBuffer for survival events.
524 SurvivalEventBuffer survival_events_; 544 SurvivalEventBuffer survival_events_;
525 545
526 // Cumulative number of incremental marking steps since creation of tracer. 546 // Cumulative number of incremental marking steps since creation of tracer.
527 int cumulative_incremental_marking_steps_; 547 int cumulative_incremental_marking_steps_;
528 548
529 // Cumulative size of incremental marking steps (in bytes) since creation of 549 // Cumulative size of incremental marking steps (in bytes) since creation of
530 // tracer. 550 // tracer.
531 intptr_t cumulative_incremental_marking_bytes_; 551 intptr_t cumulative_incremental_marking_bytes_;
532 552
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 587
568 // Counts how many tracers were started without stopping. 588 // Counts how many tracers were started without stopping.
569 int start_counter_; 589 int start_counter_;
570 590
571 DISALLOW_COPY_AND_ASSIGN(GCTracer); 591 DISALLOW_COPY_AND_ASSIGN(GCTracer);
572 }; 592 };
573 } // namespace internal 593 } // namespace internal
574 } // namespace v8 594 } // namespace v8
575 595
576 #endif // V8_HEAP_GC_TRACER_H_ 596 #endif // V8_HEAP_GC_TRACER_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/gc-tracer.cc » ('j') | src/heap/mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698