| 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::PromotionEvent::PromotionEvent(double promotion_ratio) { | 34 GCTracer::SurvivalEvent::SurvivalEvent(double promotion_ratio) { |
| 35 promotion_ratio_ = promotion_ratio; | 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), |
| (...skipping 205 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::AddPromotionRatio(double promotion_ratio) { | 260 void GCTracer::AddSurvivalRatio(double promotion_ratio) { |
| 261 promotion_events_.push_front(PromotionEvent(promotion_ratio)); | 261 survival_events_.push_front(SurvivalEvent(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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 intptr_t allocated_since_last_gc = | 367 intptr_t allocated_since_last_gc = |
| 368 current_.start_object_size - previous_.end_object_size; | 368 current_.start_object_size - previous_.end_object_size; |
| 369 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); | 369 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); |
| 370 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); | 370 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); |
| 371 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", | 371 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", |
| 372 heap_->semi_space_copied_object_size_); | 372 heap_->semi_space_copied_object_size_); |
| 373 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); | 373 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); |
| 374 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); | 374 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); |
| 375 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); | 375 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); |
| 376 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); | 376 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); |
| 377 PrintF("average_promotion_ratio=%.1f%% ", AveragePromotionRatio()); | 377 PrintF("average_survival_ratio=%.1f%% ", AverageSurvivalRatio()); |
| 378 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); | 378 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); |
| 379 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); | 379 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); |
| 380 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", | 380 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", |
| 381 NewSpaceAllocationThroughputInBytesPerMillisecond()); | 381 NewSpaceAllocationThroughputInBytesPerMillisecond()); |
| 382 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); | 382 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); |
| 383 | 383 |
| 384 if (current_.type == Event::SCAVENGER) { | 384 if (current_.type == Event::SCAVENGER) { |
| 385 PrintF("steps_count=%d ", current_.incremental_marking_steps); | 385 PrintF("steps_count=%d ", current_.incremental_marking_steps); |
| 386 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); | 386 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); |
| 387 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", | 387 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 context_disposal_events_.begin(); | 565 context_disposal_events_.begin(); |
| 566 while (iter != context_disposal_events_.end()) { | 566 while (iter != context_disposal_events_.end()) { |
| 567 end = iter->time_; | 567 end = iter->time_; |
| 568 ++iter; | 568 ++iter; |
| 569 } | 569 } |
| 570 | 570 |
| 571 return (begin - end) / context_disposal_events_.size(); | 571 return (begin - end) / context_disposal_events_.size(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 | 574 |
| 575 double GCTracer::AveragePromotionRatio() const { | 575 double GCTracer::AverageSurvivalRatio() const { |
| 576 if (promotion_events_.size() == 0) return 0.0; | 576 if (survival_events_.size() == 0) return 0.0; |
| 577 | 577 |
| 578 double sum_of_rates = 0.0; | 578 double sum_of_rates = 0.0; |
| 579 PromotionEventBuffer::const_iterator iter = promotion_events_.begin(); | 579 SurvivalEventBuffer::const_iterator iter = survival_events_.begin(); |
| 580 while (iter != promotion_events_.end()) { | 580 while (iter != survival_events_.end()) { |
| 581 sum_of_rates += iter->promotion_ratio_; | 581 sum_of_rates += iter->promotion_ratio_; |
| 582 ++iter; | 582 ++iter; |
| 583 } | 583 } |
| 584 | 584 |
| 585 return sum_of_rates / static_cast<double>(promotion_events_.size()); | 585 return sum_of_rates / static_cast<double>(survival_events_.size()); |
| 586 } | 586 } |
| 587 | 587 |
| 588 | 588 |
| 589 bool GCTracer::SurvivalEventsRecorded() const { | 589 bool GCTracer::SurvivalEventsRecorded() const { |
| 590 return promotion_events_.size() > 0; | 590 return survival_events_.size() > 0; |
| 591 } | 591 } |
| 592 | 592 |
| 593 | 593 |
| 594 void GCTracer::ResetSurvivalEvents() { promotion_events_.reset(); } | 594 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
| 595 } | 595 } |
| 596 } // namespace v8::internal | 596 } // namespace v8::internal |
| OLD | NEW |