| 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 #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 Loading... |
| 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) { | 34 GCTracer::PromotionEvent::PromotionEvent(double promotion_ratio) { |
| 35 survival_rate_ = survival_rate; | 35 promotion_ratio_ = promotion_ratio; |
| 36 } | 36 } |
| 37 | 37 |
| 38 | 38 |
| 39 GCTracer::Event::Event(Type type, const char* gc_reason, | 39 GCTracer::Event::Event(Type type, const char* gc_reason, |
| 40 const char* collector_reason) | 40 const char* collector_reason) |
| 41 : type(type), | 41 : type(type), |
| 42 gc_reason(gc_reason), | 42 gc_reason(gc_reason), |
| 43 collector_reason(collector_reason), | 43 collector_reason(collector_reason), |
| 44 start_time(0.0), | 44 start_time(0.0), |
| 45 end_time(0.0), | 45 end_time(0.0), |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 intptr_t allocation_in_bytes) { | 250 intptr_t allocation_in_bytes) { |
| 251 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes)); | 251 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes)); |
| 252 } | 252 } |
| 253 | 253 |
| 254 | 254 |
| 255 void GCTracer::AddContextDisposalTime(double time) { | 255 void GCTracer::AddContextDisposalTime(double time) { |
| 256 context_disposal_events_.push_front(ContextDisposalEvent(time)); | 256 context_disposal_events_.push_front(ContextDisposalEvent(time)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 | 259 |
| 260 void GCTracer::AddSurvivalRate(double survival_rate) { | 260 void GCTracer::AddPromotionRatio(double promotion_ratio) { |
| 261 survival_events_.push_front(SurvivalEvent(survival_rate)); | 261 promotion_events_.push_front(PromotionEvent(promotion_ratio)); |
| 262 } | 262 } |
| 263 | 263 |
| 264 | 264 |
| 265 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { | 265 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { |
| 266 cumulative_incremental_marking_steps_++; | 266 cumulative_incremental_marking_steps_++; |
| 267 cumulative_incremental_marking_bytes_ += bytes; | 267 cumulative_incremental_marking_bytes_ += bytes; |
| 268 cumulative_incremental_marking_duration_ += duration; | 268 cumulative_incremental_marking_duration_ += duration; |
| 269 longest_incremental_marking_step_ = | 269 longest_incremental_marking_step_ = |
| 270 Max(longest_incremental_marking_step_, duration); | 270 Max(longest_incremental_marking_step_, duration); |
| 271 cumulative_marking_duration_ += duration; | 271 cumulative_marking_duration_ += duration; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 intptr_t allocated_since_last_gc = | 365 intptr_t allocated_since_last_gc = |
| 366 current_.start_object_size - previous_.end_object_size; | 366 current_.start_object_size - previous_.end_object_size; |
| 367 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); | 367 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); |
| 368 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); | 368 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); |
| 369 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", | 369 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", |
| 370 heap_->semi_space_copied_object_size_); | 370 heap_->semi_space_copied_object_size_); |
| 371 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_); |
| 372 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_); |
| 373 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); | 373 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); |
| 374 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); | 374 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); |
| 375 PrintF("average_promotion_ratio=%.1f%% ", AveragePromotionRatio()); |
| 375 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); | 376 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); |
| 376 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); | 377 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); |
| 377 PrintF("average_survival_rate%.1f%% ", AverageSurvivalRate()); | |
| 378 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", | 378 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", |
| 379 NewSpaceAllocationThroughputInBytesPerMillisecond()); | 379 NewSpaceAllocationThroughputInBytesPerMillisecond()); |
| 380 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); | 380 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); |
| 381 | 381 |
| 382 if (current_.type == Event::SCAVENGER) { | 382 if (current_.type == Event::SCAVENGER) { |
| 383 PrintF("steps_count=%d ", current_.incremental_marking_steps); | 383 PrintF("steps_count=%d ", current_.incremental_marking_steps); |
| 384 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); | 384 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); |
| 385 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", | 385 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", |
| 386 ScavengeSpeedInBytesPerMillisecond()); | 386 ScavengeSpeedInBytesPerMillisecond()); |
| 387 } else { | 387 } else { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 context_disposal_events_.begin(); | 563 context_disposal_events_.begin(); |
| 564 while (iter != context_disposal_events_.end()) { | 564 while (iter != context_disposal_events_.end()) { |
| 565 end = iter->time_; | 565 end = iter->time_; |
| 566 ++iter; | 566 ++iter; |
| 567 } | 567 } |
| 568 | 568 |
| 569 return (begin - end) / context_disposal_events_.size(); | 569 return (begin - end) / context_disposal_events_.size(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 | 572 |
| 573 double GCTracer::AverageSurvivalRate() const { | 573 double GCTracer::AveragePromotionRatio() const { |
| 574 if (survival_events_.size() == 0) return 0.0; | 574 if (promotion_events_.size() == 0) return 0.0; |
| 575 | 575 |
| 576 double sum_of_rates = 0.0; | 576 double sum_of_rates = 0.0; |
| 577 SurvivalEventBuffer::const_iterator iter = survival_events_.begin(); | 577 PromotionEventBuffer::const_iterator iter = promotion_events_.begin(); |
| 578 while (iter != survival_events_.end()) { | 578 while (iter != promotion_events_.end()) { |
| 579 sum_of_rates += iter->survival_rate_; | 579 sum_of_rates += iter->promotion_ratio_; |
| 580 ++iter; | 580 ++iter; |
| 581 } | 581 } |
| 582 | 582 |
| 583 return sum_of_rates / static_cast<double>(survival_events_.size()); | 583 return sum_of_rates / static_cast<double>(promotion_events_.size()); |
| 584 } | 584 } |
| 585 | 585 |
| 586 | 586 |
| 587 bool GCTracer::SurvivalEventsRecorded() const { | 587 bool GCTracer::SurvivalEventsRecorded() const { |
| 588 return survival_events_.size() > 0; | 588 return promotion_events_.size() > 0; |
| 589 } | 589 } |
| 590 | 590 |
| 591 | 591 |
| 592 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 592 void GCTracer::ResetSurvivalEvents() { promotion_events_.reset(); } |
| 593 } | 593 } |
| 594 } // namespace v8::internal | 594 } // namespace v8::internal |
| OLD | NEW |