Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 GCTracer::Scope::~Scope() { | 37 GCTracer::Scope::~Scope() { |
| 38 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned. | 38 DCHECK(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned. |
| 39 tracer_->current_.scopes[scope_] += | 39 tracer_->current_.scopes[scope_] += |
| 40 tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_; | 40 tracer_->heap_->MonotonicallyIncreasingTimeInMs() - start_time_; |
| 41 // TODO(cbruni): remove once we fully moved to a trace-based system. | 41 // TODO(cbruni): remove once we fully moved to a trace-based system. |
| 42 if (FLAG_runtime_call_stats) { | 42 if (FLAG_runtime_call_stats) { |
| 43 tracer_->heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_); | 43 tracer_->heap_->isolate()->counters()->runtime_call_stats()->Leave(&timer_); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 const char* GCTracer::Scope::Name(ScopeId id) { | |
| 48 #define CASE(scope) \ | |
|
Michael Lippautz
2016/04/04 09:49:39
undef CASE somewhere?
ulan
2016/04/04 09:58:42
Done.
| |
| 49 case Scope::scope: \ | |
| 50 return "V8.GC_" #scope; | |
| 51 switch (id) { | |
| 52 TRACER_SCOPES(CASE) | |
| 53 case Scope::NUMBER_OF_SCOPES: | |
| 54 break; | |
| 55 } | |
| 56 return "(unknown)"; | |
| 57 } | |
| 47 | 58 |
| 48 GCTracer::Event::Event(Type type, const char* gc_reason, | 59 GCTracer::Event::Event(Type type, const char* gc_reason, |
| 49 const char* collector_reason) | 60 const char* collector_reason) |
| 50 : type(type), | 61 : type(type), |
| 51 gc_reason(gc_reason), | 62 gc_reason(gc_reason), |
| 52 collector_reason(collector_reason), | 63 collector_reason(collector_reason), |
| 53 start_time(0.0), | 64 start_time(0.0), |
| 54 end_time(0.0), | 65 end_time(0.0), |
| 55 reduce_memory(false), | 66 reduce_memory(false), |
| 56 start_object_size(0), | 67 start_object_size(0), |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 return sum / recorded_survival_ratios_.Count(); | 799 return sum / recorded_survival_ratios_.Count(); |
| 789 } | 800 } |
| 790 | 801 |
| 791 bool GCTracer::SurvivalEventsRecorded() const { | 802 bool GCTracer::SurvivalEventsRecorded() const { |
| 792 return recorded_survival_ratios_.Count() > 0; | 803 return recorded_survival_ratios_.Count() > 0; |
| 793 } | 804 } |
| 794 | 805 |
| 795 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } | 806 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } |
| 796 } // namespace internal | 807 } // namespace internal |
| 797 } // namespace v8 | 808 } // namespace v8 |
| OLD | NEW |