| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/service.h" | 5 #include "vm/service.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| 11 #include "vm/coverage.h" | 11 #include "vm/coverage.h" |
| 12 #include "vm/cpu.h" | 12 #include "vm/cpu.h" |
| 13 #include "vm/dart_api_impl.h" | 13 #include "vm/dart_api_impl.h" |
| 14 #include "vm/dart_entry.h" | 14 #include "vm/dart_entry.h" |
| 15 #include "vm/debugger.h" | 15 #include "vm/debugger.h" |
| 16 #include "vm/isolate.h" | 16 #include "vm/isolate.h" |
| 17 #include "vm/lockers.h" | 17 #include "vm/lockers.h" |
| 18 #include "vm/message.h" | 18 #include "vm/message.h" |
| 19 #include "vm/message_handler.h" | 19 #include "vm/message_handler.h" |
| 20 #include "vm/native_entry.h" | 20 #include "vm/native_entry.h" |
| 21 #include "vm/native_arguments.h" | 21 #include "vm/native_arguments.h" |
| 22 #include "vm/object.h" | 22 #include "vm/object.h" |
| 23 #include "vm/object_graph.h" | 23 #include "vm/object_graph.h" |
| 24 #include "vm/object_id_ring.h" | 24 #include "vm/object_id_ring.h" |
| 25 #include "vm/object_store.h" | 25 #include "vm/object_store.h" |
| 26 #include "vm/parser.h" | 26 #include "vm/parser.h" |
| 27 #include "vm/port.h" | 27 #include "vm/port.h" |
| 28 #include "vm/profiler.h" | 28 #include "vm/profiler_service.h" |
| 29 #include "vm/reusable_handles.h" | 29 #include "vm/reusable_handles.h" |
| 30 #include "vm/stack_frame.h" | 30 #include "vm/stack_frame.h" |
| 31 #include "vm/symbols.h" | 31 #include "vm/symbols.h" |
| 32 #include "vm/unicode.h" | 32 #include "vm/unicode.h" |
| 33 #include "vm/version.h" | 33 #include "vm/version.h" |
| 34 | 34 |
| 35 namespace dart { | 35 namespace dart { |
| 36 | 36 |
| 37 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); | 37 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); |
| 38 DEFINE_FLAG(bool, trace_service_pause_events, false, | 38 DEFINE_FLAG(bool, trace_service_pause_events, false, |
| (...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 | 2231 |
| 2232 static bool HandleIsolateGetTagProfile(Isolate* isolate, JSONStream* js) { | 2232 static bool HandleIsolateGetTagProfile(Isolate* isolate, JSONStream* js) { |
| 2233 JSONObject miniProfile(js); | 2233 JSONObject miniProfile(js); |
| 2234 miniProfile.AddProperty("type", "TagProfile"); | 2234 miniProfile.AddProperty("type", "TagProfile"); |
| 2235 miniProfile.AddProperty("id", "profile/tag"); | 2235 miniProfile.AddProperty("id", "profile/tag"); |
| 2236 isolate->vm_tag_counters()->PrintToJSONObject(&miniProfile); | 2236 isolate->vm_tag_counters()->PrintToJSONObject(&miniProfile); |
| 2237 return true; | 2237 return true; |
| 2238 } | 2238 } |
| 2239 | 2239 |
| 2240 static bool HandleIsolateGetCpuProfile(Isolate* isolate, JSONStream* js) { | 2240 static bool HandleIsolateGetCpuProfile(Isolate* isolate, JSONStream* js) { |
| 2241 // A full profile includes disassembly of all Dart code objects. | 2241 ProfilerService::TagOrder tag_order = ProfilerService::kUserVM; |
| 2242 // TODO(johnmccutchan): Add option to trigger full code dump. | |
| 2243 bool full_profile = false; | |
| 2244 Profiler::TagOrder tag_order = Profiler::kUserVM; | |
| 2245 if (js->HasParam("tags")) { | 2242 if (js->HasParam("tags")) { |
| 2246 if (js->ParamIs("tags", "None")) { | 2243 if (js->ParamIs("tags", "None")) { |
| 2247 tag_order = Profiler::kNoTags; | 2244 tag_order = ProfilerService::kNoTags; |
| 2248 } else if (js->ParamIs("tags", "UserVM")) { | 2245 } else if (js->ParamIs("tags", "UserVM")) { |
| 2249 tag_order = Profiler::kUserVM; | 2246 tag_order = ProfilerService::kUserVM; |
| 2250 } else if (js->ParamIs("tags", "UserOnly")) { | 2247 } else if (js->ParamIs("tags", "UserOnly")) { |
| 2251 tag_order = Profiler::kUser; | 2248 tag_order = ProfilerService::kUser; |
| 2252 } else if (js->ParamIs("tags", "VMUser")) { | 2249 } else if (js->ParamIs("tags", "VMUser")) { |
| 2253 tag_order = Profiler::kVMUser; | 2250 tag_order = ProfilerService::kVMUser; |
| 2254 } else if (js->ParamIs("tags", "VMOnly")) { | 2251 } else if (js->ParamIs("tags", "VMOnly")) { |
| 2255 tag_order = Profiler::kVM; | 2252 tag_order = ProfilerService::kVM; |
| 2256 } else { | 2253 } else { |
| 2257 PrintInvalidParamError(js, "tags"); | 2254 PrintInvalidParamError(js, "tags"); |
| 2258 return true; | 2255 return true; |
| 2259 } | 2256 } |
| 2260 } | 2257 } |
| 2261 Profiler::PrintJSON(isolate, js, full_profile, tag_order); | 2258 ProfilerService::PrintJSON(js, tag_order); |
| 2262 return true; | 2259 return true; |
| 2263 } | 2260 } |
| 2264 | 2261 |
| 2265 | 2262 |
| 2266 static bool HandleIsolateGetAllocationProfile(Isolate* isolate, | 2263 static bool HandleIsolateGetAllocationProfile(Isolate* isolate, |
| 2267 JSONStream* js) { | 2264 JSONStream* js) { |
| 2268 bool should_reset_accumulator = false; | 2265 bool should_reset_accumulator = false; |
| 2269 bool should_collect = false; | 2266 bool should_collect = false; |
| 2270 if (js->HasParam("reset")) { | 2267 if (js->HasParam("reset")) { |
| 2271 if (js->ParamIs("reset", "true")) { | 2268 if (js->ParamIs("reset", "true")) { |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2858 while (current != NULL) { | 2855 while (current != NULL) { |
| 2859 if (strcmp(name, current->name()) == 0) { | 2856 if (strcmp(name, current->name()) == 0) { |
| 2860 return current; | 2857 return current; |
| 2861 } | 2858 } |
| 2862 current = current->next(); | 2859 current = current->next(); |
| 2863 } | 2860 } |
| 2864 return NULL; | 2861 return NULL; |
| 2865 } | 2862 } |
| 2866 | 2863 |
| 2867 } // namespace dart | 2864 } // namespace dart |
| OLD | NEW |