| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/profiler_service.h" | 5 #include "vm/profiler_service.h" |
| 6 | 6 |
| 7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
| 8 #include "vm/native_symbol.h" | 8 #include "vm/native_symbol.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| 11 #include "vm/profiler.h" | 11 #include "vm/profiler.h" |
| 12 #include "vm/reusable_handles.h" | 12 #include "vm/reusable_handles.h" |
| 13 #include "vm/scope_timer.h" | 13 #include "vm/scope_timer.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 DECLARE_FLAG(int, profile_depth); | 17 DECLARE_FLAG(int, max_profile_depth); |
| 18 DECLARE_FLAG(int, profile_period); | 18 DECLARE_FLAG(int, profile_period); |
| 19 | 19 |
| 20 DEFINE_FLAG(bool, trace_profiler, false, "Trace profiler."); | 20 DEFINE_FLAG(bool, trace_profiler, false, "Trace profiler."); |
| 21 | 21 |
| 22 class DeoptimizedCodeSet : public ZoneAllocated { | 22 class DeoptimizedCodeSet : public ZoneAllocated { |
| 23 public: | 23 public: |
| 24 explicit DeoptimizedCodeSet(Isolate* isolate) | 24 explicit DeoptimizedCodeSet(Isolate* isolate) |
| 25 : previous_( | 25 : previous_( |
| 26 GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())), | 26 GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())), |
| 27 current_(GrowableObjectArray::ZoneHandle( | 27 current_(GrowableObjectArray::ZoneHandle( |
| (...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 | 1860 |
| 1861 void Profile::PrintJSON(JSONStream* stream) { | 1861 void Profile::PrintJSON(JSONStream* stream) { |
| 1862 ScopeTimer sw("Profile::PrintJSON", FLAG_trace_profiler); | 1862 ScopeTimer sw("Profile::PrintJSON", FLAG_trace_profiler); |
| 1863 JSONObject obj(stream); | 1863 JSONObject obj(stream); |
| 1864 obj.AddProperty("type", "_CpuProfile"); | 1864 obj.AddProperty("type", "_CpuProfile"); |
| 1865 obj.AddProperty("samplePeriod", | 1865 obj.AddProperty("samplePeriod", |
| 1866 static_cast<intptr_t>(FLAG_profile_period)); | 1866 static_cast<intptr_t>(FLAG_profile_period)); |
| 1867 obj.AddProperty("stackDepth", | 1867 obj.AddProperty("stackDepth", |
| 1868 static_cast<intptr_t>(FLAG_profile_depth)); | 1868 static_cast<intptr_t>(FLAG_max_profile_depth)); |
| 1869 obj.AddProperty("sampleCount", sample_count()); | 1869 obj.AddProperty("sampleCount", sample_count()); |
| 1870 obj.AddProperty("timeSpan", MicrosecondsToSeconds(GetTimeSpan())); | 1870 obj.AddProperty("timeSpan", MicrosecondsToSeconds(GetTimeSpan())); |
| 1871 { | 1871 { |
| 1872 JSONArray codes(&obj, "codes"); | 1872 JSONArray codes(&obj, "codes"); |
| 1873 for (intptr_t i = 0; i < live_code_->length(); i++) { | 1873 for (intptr_t i = 0; i < live_code_->length(); i++) { |
| 1874 ProfileCode* code = live_code_->At(i); | 1874 ProfileCode* code = live_code_->At(i); |
| 1875 ASSERT(code != NULL); | 1875 ASSERT(code != NULL); |
| 1876 code->PrintToJSONArray(&codes); | 1876 code->PrintToJSONArray(&codes); |
| 1877 } | 1877 } |
| 1878 for (intptr_t i = 0; i < dead_code_->length(); i++) { | 1878 for (intptr_t i = 0; i < dead_code_->length(); i++) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 ASSERT(sample_buffer != NULL); | 2107 ASSERT(sample_buffer != NULL); |
| 2108 | 2108 |
| 2109 ClearProfileVisitor clear_profile(isolate); | 2109 ClearProfileVisitor clear_profile(isolate); |
| 2110 sample_buffer->VisitSamples(&clear_profile); | 2110 sample_buffer->VisitSamples(&clear_profile); |
| 2111 | 2111 |
| 2112 // Enable profile interrupts. | 2112 // Enable profile interrupts. |
| 2113 Profiler::BeginExecution(isolate); | 2113 Profiler::BeginExecution(isolate); |
| 2114 } | 2114 } |
| 2115 | 2115 |
| 2116 } // namespace dart | 2116 } // namespace dart |
| OLD | NEW |