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 "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3228 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); | 3228 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); |
3229 ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros, | 3229 ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros, |
3230 time_extent_micros); | 3230 time_extent_micros); |
3231 } else { | 3231 } else { |
3232 PrintInvalidParamError(js, "classId"); | 3232 PrintInvalidParamError(js, "classId"); |
3233 } | 3233 } |
3234 return true; | 3234 return true; |
3235 } | 3235 } |
3236 | 3236 |
3237 | 3237 |
| 3238 static const MethodParameter* get_native_allocation_samples_params[] = { |
| 3239 NO_ISOLATE_PARAMETER, |
| 3240 new EnumParameter("tags", true, tags_enum_names), |
| 3241 new Int64Parameter("timeOriginMicros", false), |
| 3242 new Int64Parameter("timeExtentMicros", false), |
| 3243 NULL, |
| 3244 }; |
| 3245 |
| 3246 |
| 3247 static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) { |
| 3248 Profile::TagOrder tag_order = |
| 3249 EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); |
| 3250 int64_t time_origin_micros = |
| 3251 Int64Parameter::Parse(js->LookupParam("timeOriginMicros")); |
| 3252 int64_t time_extent_micros = |
| 3253 Int64Parameter::Parse(js->LookupParam("timeExtentMicros")); |
| 3254 ProfilerService::PrintNativeAllocationJSON(js, tag_order, time_origin_micros, |
| 3255 time_extent_micros); |
| 3256 return true; |
| 3257 } |
| 3258 |
| 3259 |
3238 static const MethodParameter* clear_cpu_profile_params[] = { | 3260 static const MethodParameter* clear_cpu_profile_params[] = { |
3239 RUNNABLE_ISOLATE_PARAMETER, NULL, | 3261 RUNNABLE_ISOLATE_PARAMETER, NULL, |
3240 }; | 3262 }; |
3241 | 3263 |
3242 | 3264 |
3243 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { | 3265 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { |
3244 ProfilerService::ClearSamples(); | 3266 ProfilerService::ClearSamples(); |
3245 PrintSuccess(js); | 3267 PrintSuccess(js); |
3246 return true; | 3268 return true; |
3247 } | 3269 } |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4050 { "_clearVMTimeline", ClearVMTimeline, | 4072 { "_clearVMTimeline", ClearVMTimeline, |
4051 clear_vm_timeline_params, }, | 4073 clear_vm_timeline_params, }, |
4052 { "evaluate", Evaluate, | 4074 { "evaluate", Evaluate, |
4053 evaluate_params }, | 4075 evaluate_params }, |
4054 { "evaluateInFrame", EvaluateInFrame, | 4076 { "evaluateInFrame", EvaluateInFrame, |
4055 evaluate_in_frame_params }, | 4077 evaluate_in_frame_params }, |
4056 { "_getAllocationProfile", GetAllocationProfile, | 4078 { "_getAllocationProfile", GetAllocationProfile, |
4057 get_allocation_profile_params }, | 4079 get_allocation_profile_params }, |
4058 { "_getAllocationSamples", GetAllocationSamples, | 4080 { "_getAllocationSamples", GetAllocationSamples, |
4059 get_allocation_samples_params }, | 4081 get_allocation_samples_params }, |
| 4082 { "_getNativeAllocationSamples", GetNativeAllocationSamples, |
| 4083 get_native_allocation_samples_params }, |
4060 { "getClassList", GetClassList, | 4084 { "getClassList", GetClassList, |
4061 get_class_list_params }, | 4085 get_class_list_params }, |
4062 { "_getCpuProfile", GetCpuProfile, | 4086 { "_getCpuProfile", GetCpuProfile, |
4063 get_cpu_profile_params }, | 4087 get_cpu_profile_params }, |
4064 { "_getCpuProfileTimeline", GetCpuProfileTimeline, | 4088 { "_getCpuProfileTimeline", GetCpuProfileTimeline, |
4065 get_cpu_profile_timeline_params }, | 4089 get_cpu_profile_timeline_params }, |
4066 { "getFlagList", GetFlagList, | 4090 { "getFlagList", GetFlagList, |
4067 get_flag_list_params }, | 4091 get_flag_list_params }, |
4068 { "_getHeapMap", GetHeapMap, | 4092 { "_getHeapMap", GetHeapMap, |
4069 get_heap_map_params }, | 4093 get_heap_map_params }, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4151 if (strcmp(method_name, method.name) == 0) { | 4175 if (strcmp(method_name, method.name) == 0) { |
4152 return &method; | 4176 return &method; |
4153 } | 4177 } |
4154 } | 4178 } |
4155 return NULL; | 4179 return NULL; |
4156 } | 4180 } |
4157 | 4181 |
4158 #endif // !PRODUCT | 4182 #endif // !PRODUCT |
4159 | 4183 |
4160 } // namespace dart | 4184 } // namespace dart |
OLD | NEW |