| 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 last_incremental_marking_step_duration_(0.0), |
| 78 longest_incremental_marking_step_(0.0) { | 79 longest_incremental_marking_step_(0.0) { |
| 79 current_ = Event(Event::START, NULL, NULL); | 80 current_ = Event(Event::START, NULL, NULL); |
| 80 current_.end_time = base::OS::TimeCurrentMillis(); | 81 current_.end_time = base::OS::TimeCurrentMillis(); |
| 81 previous_ = previous_mark_compactor_event_ = current_; | 82 previous_ = previous_mark_compactor_event_ = current_; |
| 82 } | 83 } |
| 83 | 84 |
| 84 | 85 |
| 85 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, | 86 void GCTracer::Start(GarbageCollector collector, const char* gc_reason, |
| 86 const char* collector_reason) { | 87 const char* collector_reason) { |
| 87 previous_ = current_; | 88 previous_ = current_; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 166 |
| 166 heap_->PrintShortHeapStatistics(); | 167 heap_->PrintShortHeapStatistics(); |
| 167 } | 168 } |
| 168 } | 169 } |
| 169 | 170 |
| 170 | 171 |
| 171 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { | 172 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { |
| 172 cumulative_incremental_marking_steps_++; | 173 cumulative_incremental_marking_steps_++; |
| 173 cumulative_incremental_marking_bytes_ += bytes; | 174 cumulative_incremental_marking_bytes_ += bytes; |
| 174 cumulative_incremental_marking_duration_ += duration; | 175 cumulative_incremental_marking_duration_ += duration; |
| 176 last_incremental_marking_step_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); |
| 177 } | 179 } |
| 178 | 180 |
| 179 | 181 |
| 180 void GCTracer::Print() const { | 182 void GCTracer::Print() const { |
| 181 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); | 183 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); |
| 182 | 184 |
| 183 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", current_.TypeName(false), | 185 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", current_.TypeName(false), |
| 184 static_cast<double>(current_.start_object_size) / MB, | 186 static_cast<double>(current_.start_object_size) / MB, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 durations += iter->incremental_marking_duration; | 375 durations += iter->incremental_marking_duration; |
| 374 ++iter; | 376 ++iter; |
| 375 } | 377 } |
| 376 | 378 |
| 377 if (durations == 0.0) return 0; | 379 if (durations == 0.0) return 0; |
| 378 | 380 |
| 379 return static_cast<intptr_t>(bytes / durations); | 381 return static_cast<intptr_t>(bytes / durations); |
| 380 } | 382 } |
| 381 } | 383 } |
| 382 } // namespace v8::internal | 384 } // namespace v8::internal |
| OLD | NEW |