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

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

Issue 785593002: Shrink initial old generation size based on new space survival rate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « src/heap/gc-tracer.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/gc-tracer.h" 7 #include "src/heap/gc-tracer.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 13 matching lines...) Expand all
24 duration_ = duration; 24 duration_ = duration;
25 allocation_in_bytes_ = allocation_in_bytes; 25 allocation_in_bytes_ = allocation_in_bytes;
26 } 26 }
27 27
28 28
29 GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) { 29 GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) {
30 time_ = time; 30 time_ = time;
31 } 31 }
32 32
33 33
34 GCTracer::SurvivalEvent::SurvivalEvent(double survival_rate) {
35 survival_rate_ = survival_rate;
36 }
37
38
34 GCTracer::Event::Event(Type type, const char* gc_reason, 39 GCTracer::Event::Event(Type type, const char* gc_reason,
35 const char* collector_reason) 40 const char* collector_reason)
36 : type(type), 41 : type(type),
37 gc_reason(gc_reason), 42 gc_reason(gc_reason),
38 collector_reason(collector_reason), 43 collector_reason(collector_reason),
39 start_time(0.0), 44 start_time(0.0),
40 end_time(0.0), 45 end_time(0.0),
41 start_object_size(0), 46 start_object_size(0),
42 end_object_size(0), 47 end_object_size(0),
43 start_memory_size(0), 48 start_memory_size(0),
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 intptr_t allocation_in_bytes) { 250 intptr_t allocation_in_bytes) {
246 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes)); 251 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes));
247 } 252 }
248 253
249 254
250 void GCTracer::AddContextDisposalTime(double time) { 255 void GCTracer::AddContextDisposalTime(double time) {
251 context_disposal_events_.push_front(ContextDisposalEvent(time)); 256 context_disposal_events_.push_front(ContextDisposalEvent(time));
252 } 257 }
253 258
254 259
260 void GCTracer::AddSurvivalRate(double survival_rate) {
261 survival_events_.push_front(SurvivalEvent(survival_rate));
262 }
263
264
255 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { 265 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) {
256 cumulative_incremental_marking_steps_++; 266 cumulative_incremental_marking_steps_++;
257 cumulative_incremental_marking_bytes_ += bytes; 267 cumulative_incremental_marking_bytes_ += bytes;
258 cumulative_incremental_marking_duration_ += duration; 268 cumulative_incremental_marking_duration_ += duration;
259 longest_incremental_marking_step_ = 269 longest_incremental_marking_step_ =
260 Max(longest_incremental_marking_step_, duration); 270 Max(longest_incremental_marking_step_, duration);
261 cumulative_marking_duration_ += duration; 271 cumulative_marking_duration_ += duration;
262 if (bytes > 0) { 272 if (bytes > 0) {
263 cumulative_pure_incremental_marking_duration_ += duration; 273 cumulative_pure_incremental_marking_duration_ += duration;
264 } 274 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 364
355 intptr_t allocated_since_last_gc = 365 intptr_t allocated_since_last_gc =
356 current_.start_object_size - previous_.end_object_size; 366 current_.start_object_size - previous_.end_object_size;
357 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); 367 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc);
358 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); 368 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_);
359 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", 369 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
360 heap_->semi_space_copied_object_size_); 370 heap_->semi_space_copied_object_size_);
361 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); 371 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_);
362 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); 372 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
363 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); 373 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
374 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_);
364 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); 375 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
365 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); 376 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
377 PrintF("average_survival_rate%.1f%% ", AverageSurvivalRate());
366 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", 378 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
367 NewSpaceAllocationThroughputInBytesPerMillisecond()); 379 NewSpaceAllocationThroughputInBytesPerMillisecond());
368 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); 380 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds());
369 381
370 if (current_.type == Event::SCAVENGER) { 382 if (current_.type == Event::SCAVENGER) {
371 PrintF("steps_count=%d ", current_.incremental_marking_steps); 383 PrintF("steps_count=%d ", current_.incremental_marking_steps);
372 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); 384 PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
373 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", 385 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ",
374 ScavengeSpeedInBytesPerMillisecond()); 386 ScavengeSpeedInBytesPerMillisecond());
375 } else { 387 } else {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 double end = 0.0; 561 double end = 0.0;
550 ContextDisposalEventBuffer::const_iterator iter = 562 ContextDisposalEventBuffer::const_iterator iter =
551 context_disposal_events_.begin(); 563 context_disposal_events_.begin();
552 while (iter != context_disposal_events_.end()) { 564 while (iter != context_disposal_events_.end()) {
553 end = iter->time_; 565 end = iter->time_;
554 ++iter; 566 ++iter;
555 } 567 }
556 568
557 return (begin - end) / context_disposal_events_.size(); 569 return (begin - end) / context_disposal_events_.size();
558 } 570 }
571
572
573 double GCTracer::AverageSurvivalRate() const {
574 if (survival_events_.size() == 0) return 0.0;
575
576 double sum_of_rates = 0.0;
577 SurvivalEventBuffer::const_iterator iter = survival_events_.begin();
578 while (iter != survival_events_.end()) {
579 sum_of_rates += iter->survival_rate_;
580 ++iter;
581 }
582
583 return sum_of_rates / static_cast<double>(survival_events_.size());
584 }
585
586
587 bool GCTracer::SurvivalEventsRecorded() const {
588 return survival_events_.size() > 0;
589 }
559 } 590 }
560 } // namespace v8::internal 591 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698