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/gc-tracer.h" | 7 #include "src/gc-tracer.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 return "Unknown Event Type"; | 69 return "Unknown Event Type"; |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 GCTracer::GCTracer(Heap* heap) | 73 GCTracer::GCTracer(Heap* heap) |
74 : heap_(heap), | 74 : heap_(heap), |
75 cumulative_incremental_marking_steps_(0), | 75 cumulative_incremental_marking_steps_(0), |
76 cumulative_incremental_marking_bytes_(0), | 76 cumulative_incremental_marking_bytes_(0), |
77 cumulative_incremental_marking_duration_(0.0), | 77 cumulative_incremental_marking_duration_(0.0), |
78 longest_incremental_marking_step_(0.0) { | 78 longest_incremental_marking_step_(0.0), |
| 79 cumulative_marking_duration_(0.0), |
| 80 cumulative_sweeping_duration_(0.0) { |
79 current_ = Event(Event::START, NULL, NULL); | 81 current_ = Event(Event::START, NULL, NULL); |
80 current_.end_time = base::OS::TimeCurrentMillis(); | 82 current_.end_time = base::OS::TimeCurrentMillis(); |
81 previous_ = previous_mark_compactor_event_ = current_; | 83 previous_ = previous_mark_compactor_event_ = current_; |
82 } | 84 } |
83 | 85 |
84 | 86 |
85 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, | 87 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, |
86 const char* collector_reason) { | 88 const char* collector_reason) { |
87 previous_ = current_; | 89 previous_ = current_; |
88 if (current_.type == Event::MARK_COMPACTOR) | 90 if (current_.type == Event::MARK_COMPACTOR) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 169 } |
168 } | 170 } |
169 | 171 |
170 | 172 |
171 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { | 173 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { |
172 cumulative_incremental_marking_steps_++; | 174 cumulative_incremental_marking_steps_++; |
173 cumulative_incremental_marking_bytes_ += bytes; | 175 cumulative_incremental_marking_bytes_ += bytes; |
174 cumulative_incremental_marking_duration_ += duration; | 176 cumulative_incremental_marking_duration_ += duration; |
175 longest_incremental_marking_step_ = | 177 longest_incremental_marking_step_ = |
176 Max(longest_incremental_marking_step_, duration); | 178 Max(longest_incremental_marking_step_, duration); |
| 179 cumulative_marking_duration_ += duration; |
177 } | 180 } |
178 | 181 |
179 | 182 |
180 void GCTracer::Print() const { | 183 void GCTracer::Print() const { |
181 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); | 184 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); |
182 | 185 |
183 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", current_.TypeName(false), | 186 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", current_.TypeName(false), |
184 static_cast<double>(current_.start_object_size) / MB, | 187 static_cast<double>(current_.start_object_size) / MB, |
185 static_cast<double>(current_.start_memory_size) / MB, | 188 static_cast<double>(current_.start_memory_size) / MB, |
186 static_cast<double>(current_.end_object_size) / MB, | 189 static_cast<double>(current_.end_object_size) / MB, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 durations += iter->incremental_marking_duration; | 376 durations += iter->incremental_marking_duration; |
374 ++iter; | 377 ++iter; |
375 } | 378 } |
376 | 379 |
377 if (durations == 0.0) return 0; | 380 if (durations == 0.0) return 0; |
378 | 381 |
379 return static_cast<intptr_t>(bytes / durations); | 382 return static_cast<intptr_t>(bytes / durations); |
380 } | 383 } |
381 } | 384 } |
382 } // namespace v8::internal | 385 } // namespace v8::internal |
OLD | NEW |