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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 DCHECK(start_counter_ >= 0); | 177 DCHECK(start_counter_ >= 0); |
178 DCHECK((collector == SCAVENGER && current_.type == Event::SCAVENGER) || | 178 DCHECK((collector == SCAVENGER && current_.type == Event::SCAVENGER) || |
179 (collector == MARK_COMPACTOR && | 179 (collector == MARK_COMPACTOR && |
180 (current_.type == Event::MARK_COMPACTOR || | 180 (current_.type == Event::MARK_COMPACTOR || |
181 current_.type == Event::INCREMENTAL_MARK_COMPACTOR))); | 181 current_.type == Event::INCREMENTAL_MARK_COMPACTOR))); |
182 | 182 |
183 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); | 183 current_.end_time = heap_->MonotonicallyIncreasingTimeInMs(); |
184 current_.end_object_size = heap_->SizeOfObjects(); | 184 current_.end_object_size = heap_->SizeOfObjects(); |
185 current_.end_memory_size = heap_->isolate()->memory_allocator()->Size(); | 185 current_.end_memory_size = heap_->isolate()->memory_allocator()->Size(); |
186 current_.end_holes_size = CountTotalHolesSize(heap_); | 186 current_.end_holes_size = CountTotalHolesSize(heap_); |
| 187 current_.survived_new_space_object_size = heap_->SurvivedNewSpaceObjectSize(); |
187 | 188 |
188 AddAllocation(current_.end_time); | 189 AddAllocation(current_.end_time); |
189 | 190 |
190 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); | 191 int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); |
191 int used_memory = static_cast<int>(current_.end_object_size / KB); | 192 int used_memory = static_cast<int>(current_.end_object_size / KB); |
192 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( | 193 heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( |
193 current_.end_time, committed_memory); | 194 current_.end_time, committed_memory); |
194 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( | 195 heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( |
195 current_.end_time, used_memory); | 196 current_.end_time, used_memory); |
196 | 197 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 durations += iter->pure_incremental_marking_duration; | 560 durations += iter->pure_incremental_marking_duration; |
560 ++iter; | 561 ++iter; |
561 } | 562 } |
562 | 563 |
563 if (durations == 0.0) return 0; | 564 if (durations == 0.0) return 0; |
564 // Make sure the result is at least 1. | 565 // Make sure the result is at least 1. |
565 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); | 566 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); |
566 } | 567 } |
567 | 568 |
568 | 569 |
569 intptr_t GCTracer::ScavengeSpeedInBytesPerMillisecond() const { | 570 intptr_t GCTracer::ScavengeSpeedInBytesPerMillisecond( |
| 571 ScavengeSpeedMode mode) const { |
570 intptr_t bytes = 0; | 572 intptr_t bytes = 0; |
571 double durations = 0.0; | 573 double durations = 0.0; |
572 EventBuffer::const_iterator iter = scavenger_events_.begin(); | 574 EventBuffer::const_iterator iter = scavenger_events_.begin(); |
573 while (iter != scavenger_events_.end()) { | 575 while (iter != scavenger_events_.end()) { |
574 bytes += iter->new_space_object_size; | 576 bytes += mode == kForAllObjects ? iter->new_space_object_size |
| 577 : iter->survived_new_space_object_size; |
575 durations += iter->end_time - iter->start_time; | 578 durations += iter->end_time - iter->start_time; |
576 ++iter; | 579 ++iter; |
577 } | 580 } |
578 | 581 |
579 if (durations == 0.0) return 0; | 582 if (durations == 0.0) return 0; |
580 // Make sure the result is at least 1. | 583 // Make sure the result is at least 1. |
581 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); | 584 return Max<size_t>(static_cast<size_t>(bytes / durations + 0.5), 1); |
582 } | 585 } |
583 | 586 |
584 | 587 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 726 |
724 | 727 |
725 bool GCTracer::SurvivalEventsRecorded() const { | 728 bool GCTracer::SurvivalEventsRecorded() const { |
726 return survival_events_.size() > 0; | 729 return survival_events_.size() > 0; |
727 } | 730 } |
728 | 731 |
729 | 732 |
730 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 733 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
731 } // namespace internal | 734 } // namespace internal |
732 } // namespace v8 | 735 } // namespace v8 |
OLD | NEW |