| 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" |
| (...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 | 2128 |
| 2129 | 2129 |
| 2130 static bool GetCpuProfile(Isolate* isolate, JSONStream* js) { | 2130 static bool GetCpuProfile(Isolate* isolate, JSONStream* js) { |
| 2131 ProfilerService::TagOrder tag_order = | 2131 ProfilerService::TagOrder tag_order = |
| 2132 EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); | 2132 EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); |
| 2133 ProfilerService::PrintJSON(js, tag_order); | 2133 ProfilerService::PrintJSON(js, tag_order); |
| 2134 return true; | 2134 return true; |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 | 2137 |
| 2138 static const MethodParameter* clear_cpu_profile_params[] = { |
| 2139 ISOLATE_PARAMETER, |
| 2140 NULL, |
| 2141 }; |
| 2142 |
| 2143 |
| 2144 static bool ClearCpuProfile(Isolate* isolate, JSONStream* js) { |
| 2145 ProfilerService::ClearSamples(); |
| 2146 JSONObject jsobj(js); |
| 2147 jsobj.AddProperty("type", "Success"); |
| 2148 return true; |
| 2149 } |
| 2150 |
| 2151 |
| 2138 static const MethodParameter* get_allocation_profile_params[] = { | 2152 static const MethodParameter* get_allocation_profile_params[] = { |
| 2139 ISOLATE_PARAMETER, | 2153 ISOLATE_PARAMETER, |
| 2140 NULL, | 2154 NULL, |
| 2141 }; | 2155 }; |
| 2142 | 2156 |
| 2143 | 2157 |
| 2144 static bool GetAllocationProfile(Isolate* isolate, JSONStream* js) { | 2158 static bool GetAllocationProfile(Isolate* isolate, JSONStream* js) { |
| 2145 bool should_reset_accumulator = false; | 2159 bool should_reset_accumulator = false; |
| 2146 bool should_collect = false; | 2160 bool should_collect = false; |
| 2147 if (js->HasParam("reset")) { | 2161 if (js->HasParam("reset")) { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 { "_respondWithMalformedJson", _RespondWithMalformedJson, | 2504 { "_respondWithMalformedJson", _RespondWithMalformedJson, |
| 2491 NULL }, | 2505 NULL }, |
| 2492 { "_respondWithMalformedObject", _RespondWithMalformedObject, | 2506 { "_respondWithMalformedObject", _RespondWithMalformedObject, |
| 2493 NULL }, | 2507 NULL }, |
| 2494 { "_triggerEchoEvent", _TriggerEchoEvent, | 2508 { "_triggerEchoEvent", _TriggerEchoEvent, |
| 2495 NULL }, | 2509 NULL }, |
| 2496 { "addBreakpoint", AddBreakpoint, | 2510 { "addBreakpoint", AddBreakpoint, |
| 2497 add_breakpoint_params }, | 2511 add_breakpoint_params }, |
| 2498 { "addBreakpointAtEntry", AddBreakpointAtEntry, | 2512 { "addBreakpointAtEntry", AddBreakpointAtEntry, |
| 2499 add_breakpoint_at_entry_params }, | 2513 add_breakpoint_at_entry_params }, |
| 2514 { "clearCpuProfile", ClearCpuProfile, |
| 2515 clear_cpu_profile_params }, |
| 2500 { "eval", Eval, | 2516 { "eval", Eval, |
| 2501 eval_params }, | 2517 eval_params }, |
| 2502 { "getAllocationProfile", GetAllocationProfile, | 2518 { "getAllocationProfile", GetAllocationProfile, |
| 2503 get_allocation_profile_params }, | 2519 get_allocation_profile_params }, |
| 2504 { "getBreakpoints", GetBreakpoints, | 2520 { "getBreakpoints", GetBreakpoints, |
| 2505 get_breakpoints_params }, | 2521 get_breakpoints_params }, |
| 2506 { "getCallSiteData", GetCallSiteData, | 2522 { "getCallSiteData", GetCallSiteData, |
| 2507 get_call_site_data_params }, | 2523 get_call_site_data_params }, |
| 2508 { "getClassList", GetClassList, | 2524 { "getClassList", GetClassList, |
| 2509 get_class_list_params }, | 2525 get_class_list_params }, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 ServiceMethodDescriptor& method = service_methods_[i]; | 2581 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2566 if (strcmp(method_name, method.name) == 0) { | 2582 if (strcmp(method_name, method.name) == 0) { |
| 2567 return &method; | 2583 return &method; |
| 2568 } | 2584 } |
| 2569 } | 2585 } |
| 2570 return NULL; | 2586 return NULL; |
| 2571 } | 2587 } |
| 2572 | 2588 |
| 2573 | 2589 |
| 2574 } // namespace dart | 2590 } // namespace dart |
| OLD | NEW |