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) \ |
| 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 #undef CASE |
| 57 return "(unknown)"; |
| 58 } |
47 | 59 |
48 GCTracer::Event::Event(Type type, const char* gc_reason, | 60 GCTracer::Event::Event(Type type, const char* gc_reason, |
49 const char* collector_reason) | 61 const char* collector_reason) |
50 : type(type), | 62 : type(type), |
51 gc_reason(gc_reason), | 63 gc_reason(gc_reason), |
52 collector_reason(collector_reason), | 64 collector_reason(collector_reason), |
53 start_time(0.0), | 65 start_time(0.0), |
54 end_time(0.0), | 66 end_time(0.0), |
55 reduce_memory(false), | 67 reduce_memory(false), |
56 start_object_size(0), | 68 start_object_size(0), |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 return sum / recorded_survival_ratios_.Count(); | 800 return sum / recorded_survival_ratios_.Count(); |
789 } | 801 } |
790 | 802 |
791 bool GCTracer::SurvivalEventsRecorded() const { | 803 bool GCTracer::SurvivalEventsRecorded() const { |
792 return recorded_survival_ratios_.Count() > 0; | 804 return recorded_survival_ratios_.Count() > 0; |
793 } | 805 } |
794 | 806 |
795 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } | 807 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } |
796 } // namespace internal | 808 } // namespace internal |
797 } // namespace v8 | 809 } // namespace v8 |
OLD | NEW |