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/heap/gc-tracer.h" | 5 #include "src/heap/gc-tracer.h" |
6 | 6 |
7 #include "src/counters.h" | 7 #include "src/counters.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 GCTracer::Event::Event(Type type, const char* gc_reason, | 41 GCTracer::Event::Event(Type type, const char* gc_reason, |
42 const char* collector_reason) | 42 const char* collector_reason) |
43 : type(type), | 43 : type(type), |
44 gc_reason(gc_reason), | 44 gc_reason(gc_reason), |
45 collector_reason(collector_reason), | 45 collector_reason(collector_reason), |
46 start_time(0.0), | 46 start_time(0.0), |
47 end_time(0.0), | 47 end_time(0.0), |
| 48 reduce_memory(false), |
48 start_object_size(0), | 49 start_object_size(0), |
49 end_object_size(0), | 50 end_object_size(0), |
50 start_memory_size(0), | 51 start_memory_size(0), |
51 end_memory_size(0), | 52 end_memory_size(0), |
52 start_holes_size(0), | 53 start_holes_size(0), |
53 end_holes_size(0), | 54 end_holes_size(0), |
54 cumulative_incremental_marking_steps(0), | 55 cumulative_incremental_marking_steps(0), |
55 incremental_marking_steps(0), | 56 incremental_marking_steps(0), |
56 cumulative_incremental_marking_bytes(0), | 57 cumulative_incremental_marking_bytes(0), |
57 incremental_marking_bytes(0), | 58 incremental_marking_bytes(0), |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 current_ = Event(Event::SCAVENGER, gc_reason, collector_reason); | 132 current_ = Event(Event::SCAVENGER, gc_reason, collector_reason); |
132 } else if (collector == MARK_COMPACTOR) { | 133 } else if (collector == MARK_COMPACTOR) { |
133 if (heap_->incremental_marking()->WasActivated()) { | 134 if (heap_->incremental_marking()->WasActivated()) { |
134 current_ = | 135 current_ = |
135 Event(Event::INCREMENTAL_MARK_COMPACTOR, gc_reason, collector_reason); | 136 Event(Event::INCREMENTAL_MARK_COMPACTOR, gc_reason, collector_reason); |
136 } else { | 137 } else { |
137 current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason); | 138 current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason); |
138 } | 139 } |
139 } | 140 } |
140 | 141 |
| 142 current_.reduce_memory = heap_->ShouldReduceMemory(); |
141 current_.start_time = start_time; | 143 current_.start_time = start_time; |
142 current_.start_object_size = heap_->SizeOfObjects(); | 144 current_.start_object_size = heap_->SizeOfObjects(); |
143 current_.start_memory_size = heap_->isolate()->memory_allocator()->Size(); | 145 current_.start_memory_size = heap_->isolate()->memory_allocator()->Size(); |
144 current_.start_holes_size = CountTotalHolesSize(heap_); | 146 current_.start_holes_size = CountTotalHolesSize(heap_); |
145 current_.new_space_object_size = | 147 current_.new_space_object_size = |
146 heap_->new_space()->top() - heap_->new_space()->bottom(); | 148 heap_->new_space()->top() - heap_->new_space()->bottom(); |
147 | 149 |
148 current_.cumulative_incremental_marking_steps = | 150 current_.cumulative_incremental_marking_steps = |
149 cumulative_incremental_marking_steps_; | 151 cumulative_incremental_marking_steps_; |
150 current_.cumulative_incremental_marking_bytes = | 152 current_.cumulative_incremental_marking_bytes = |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 void GCTracer::PrintNVP() const { | 395 void GCTracer::PrintNVP() const { |
394 PrintIsolate(heap_->isolate(), "[I:%p] %8.0f ms: ", heap_->isolate(), | 396 PrintIsolate(heap_->isolate(), "[I:%p] %8.0f ms: ", heap_->isolate(), |
395 heap_->isolate()->time_millis_since_init()); | 397 heap_->isolate()->time_millis_since_init()); |
396 | 398 |
397 double duration = current_.end_time - current_.start_time; | 399 double duration = current_.end_time - current_.start_time; |
398 double spent_in_mutator = current_.start_time - previous_.end_time; | 400 double spent_in_mutator = current_.start_time - previous_.end_time; |
399 | 401 |
400 PrintF("pause=%.1f ", duration); | 402 PrintF("pause=%.1f ", duration); |
401 PrintF("mutator=%.1f ", spent_in_mutator); | 403 PrintF("mutator=%.1f ", spent_in_mutator); |
402 PrintF("gc=%s ", current_.TypeName(true)); | 404 PrintF("gc=%s ", current_.TypeName(true)); |
| 405 PrintF("reduce_memory=%d ", current_.reduce_memory); |
403 | 406 |
404 switch (current_.type) { | 407 switch (current_.type) { |
405 case Event::SCAVENGER: | 408 case Event::SCAVENGER: |
406 PrintF("scavenge=%.2f ", current_.scopes[Scope::SCAVENGER_SCAVENGE]); | 409 PrintF("scavenge=%.2f ", current_.scopes[Scope::SCAVENGER_SCAVENGE]); |
407 PrintF("old_new=%.2f ", | 410 PrintF("old_new=%.2f ", |
408 current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS]); | 411 current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS]); |
409 PrintF("weak=%.2f ", current_.scopes[Scope::SCAVENGER_WEAK]); | 412 PrintF("weak=%.2f ", current_.scopes[Scope::SCAVENGER_WEAK]); |
410 PrintF("roots=%.2f ", current_.scopes[Scope::SCAVENGER_ROOTS]); | 413 PrintF("roots=%.2f ", current_.scopes[Scope::SCAVENGER_ROOTS]); |
411 PrintF("code=%.2f ", | 414 PrintF("code=%.2f ", |
412 current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES]); | 415 current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES]); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 | 751 |
749 | 752 |
750 bool GCTracer::SurvivalEventsRecorded() const { | 753 bool GCTracer::SurvivalEventsRecorded() const { |
751 return survival_events_.size() > 0; | 754 return survival_events_.size() > 0; |
752 } | 755 } |
753 | 756 |
754 | 757 |
755 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } | 758 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } |
756 } // namespace internal | 759 } // namespace internal |
757 } // namespace v8 | 760 } // namespace v8 |
OLD | NEW |