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) { | |
35 survival_rate_ = survival_rate; | |
36 } | |
37 | |
38 | |
39 GCTracer::Event::Event(Type type, const char* gc_reason, | 34 GCTracer::Event::Event(Type type, const char* gc_reason, |
40 const char* collector_reason) | 35 const char* collector_reason) |
41 : type(type), | 36 : type(type), |
42 gc_reason(gc_reason), | 37 gc_reason(gc_reason), |
43 collector_reason(collector_reason), | 38 collector_reason(collector_reason), |
44 start_time(0.0), | 39 start_time(0.0), |
45 end_time(0.0), | 40 end_time(0.0), |
46 start_object_size(0), | 41 start_object_size(0), |
47 end_object_size(0), | 42 end_object_size(0), |
48 start_memory_size(0), | 43 start_memory_size(0), |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 intptr_t allocation_in_bytes) { | 245 intptr_t allocation_in_bytes) { |
251 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes)); | 246 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes)); |
252 } | 247 } |
253 | 248 |
254 | 249 |
255 void GCTracer::AddContextDisposalTime(double time) { | 250 void GCTracer::AddContextDisposalTime(double time) { |
256 context_disposal_events_.push_front(ContextDisposalEvent(time)); | 251 context_disposal_events_.push_front(ContextDisposalEvent(time)); |
257 } | 252 } |
258 | 253 |
259 | 254 |
260 void GCTracer::AddSurvivalRate(double survival_rate) { | |
261 survival_events_.push_front(SurvivalEvent(survival_rate)); | |
262 } | |
263 | |
264 | |
265 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { | 255 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { |
266 cumulative_incremental_marking_steps_++; | 256 cumulative_incremental_marking_steps_++; |
267 cumulative_incremental_marking_bytes_ += bytes; | 257 cumulative_incremental_marking_bytes_ += bytes; |
268 cumulative_incremental_marking_duration_ += duration; | 258 cumulative_incremental_marking_duration_ += duration; |
269 longest_incremental_marking_step_ = | 259 longest_incremental_marking_step_ = |
270 Max(longest_incremental_marking_step_, duration); | 260 Max(longest_incremental_marking_step_, duration); |
271 cumulative_marking_duration_ += duration; | 261 cumulative_marking_duration_ += duration; |
272 if (bytes > 0) { | 262 if (bytes > 0) { |
273 cumulative_pure_incremental_marking_duration_ += duration; | 263 cumulative_pure_incremental_marking_duration_ += duration; |
274 } | 264 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 354 |
365 intptr_t allocated_since_last_gc = | 355 intptr_t allocated_since_last_gc = |
366 current_.start_object_size - previous_.end_object_size; | 356 current_.start_object_size - previous_.end_object_size; |
367 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); | 357 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc); |
368 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); | 358 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); |
369 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", | 359 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", |
370 heap_->semi_space_copied_object_size_); | 360 heap_->semi_space_copied_object_size_); |
371 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); | 361 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_); | 362 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); |
373 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); | 363 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); |
374 PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_); | |
375 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); | 364 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); |
376 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); | 365 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 ", | 366 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", |
379 NewSpaceAllocationThroughputInBytesPerMillisecond()); | 367 NewSpaceAllocationThroughputInBytesPerMillisecond()); |
380 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); | 368 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds()); |
381 | 369 |
382 if (current_.type == Event::SCAVENGER) { | 370 if (current_.type == Event::SCAVENGER) { |
383 PrintF("steps_count=%d ", current_.incremental_marking_steps); | 371 PrintF("steps_count=%d ", current_.incremental_marking_steps); |
384 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); | 372 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); |
385 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", | 373 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", |
386 ScavengeSpeedInBytesPerMillisecond()); | 374 ScavengeSpeedInBytesPerMillisecond()); |
387 } else { | 375 } else { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 double end = 0.0; | 549 double end = 0.0; |
562 ContextDisposalEventBuffer::const_iterator iter = | 550 ContextDisposalEventBuffer::const_iterator iter = |
563 context_disposal_events_.begin(); | 551 context_disposal_events_.begin(); |
564 while (iter != context_disposal_events_.end()) { | 552 while (iter != context_disposal_events_.end()) { |
565 end = iter->time_; | 553 end = iter->time_; |
566 ++iter; | 554 ++iter; |
567 } | 555 } |
568 | 556 |
569 return (begin - end) / context_disposal_events_.size(); | 557 return (begin - end) / context_disposal_events_.size(); |
570 } | 558 } |
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 } | |
590 } | 559 } |
591 } // namespace v8::internal | 560 } // namespace v8::internal |
OLD | NEW |