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 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3208 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); | 3208 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); |
3209 ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros, | 3209 ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros, |
3210 time_extent_micros); | 3210 time_extent_micros); |
3211 } else { | 3211 } else { |
3212 PrintInvalidParamError(js, "classId"); | 3212 PrintInvalidParamError(js, "classId"); |
3213 } | 3213 } |
3214 return true; | 3214 return true; |
3215 } | 3215 } |
3216 | 3216 |
3217 | 3217 |
| 3218 static const MethodParameter* get_native_allocation_samples_params[] = { |
| 3219 RUNNABLE_ISOLATE_PARAMETER, |
| 3220 new EnumParameter("tags", true, tags_enum_names), |
| 3221 new Int64Parameter("timeOriginMicros", false), |
| 3222 new Int64Parameter("timeExtentMicros", false), |
| 3223 NULL, |
| 3224 }; |
| 3225 |
| 3226 |
| 3227 static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) { |
| 3228 Profile::TagOrder tag_order = |
| 3229 EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); |
| 3230 int64_t time_origin_micros = |
| 3231 Int64Parameter::Parse(js->LookupParam("timeOriginMicros")); |
| 3232 int64_t time_extent_micros = |
| 3233 Int64Parameter::Parse(js->LookupParam("timeExtentMicros")); |
| 3234 ProfilerService::PrintNativeAllocationJSON(js, tag_order, time_origin_micros, |
| 3235 time_extent_micros); |
| 3236 return true; |
| 3237 } |
| 3238 |
| 3239 |
3218 static const MethodParameter* clear_cpu_profile_params[] = { | 3240 static const MethodParameter* clear_cpu_profile_params[] = { |
3219 RUNNABLE_ISOLATE_PARAMETER, NULL, | 3241 RUNNABLE_ISOLATE_PARAMETER, NULL, |
3220 }; | 3242 }; |
3221 | 3243 |
3222 | 3244 |
3223 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { | 3245 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { |
3224 ProfilerService::ClearSamples(); | 3246 ProfilerService::ClearSamples(); |
3225 PrintSuccess(js); | 3247 PrintSuccess(js); |
3226 return true; | 3248 return true; |
3227 } | 3249 } |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4034 { "_clearVMTimeline", ClearVMTimeline, | 4056 { "_clearVMTimeline", ClearVMTimeline, |
4035 clear_vm_timeline_params, }, | 4057 clear_vm_timeline_params, }, |
4036 { "evaluate", Evaluate, | 4058 { "evaluate", Evaluate, |
4037 evaluate_params }, | 4059 evaluate_params }, |
4038 { "evaluateInFrame", EvaluateInFrame, | 4060 { "evaluateInFrame", EvaluateInFrame, |
4039 evaluate_in_frame_params }, | 4061 evaluate_in_frame_params }, |
4040 { "_getAllocationProfile", GetAllocationProfile, | 4062 { "_getAllocationProfile", GetAllocationProfile, |
4041 get_allocation_profile_params }, | 4063 get_allocation_profile_params }, |
4042 { "_getAllocationSamples", GetAllocationSamples, | 4064 { "_getAllocationSamples", GetAllocationSamples, |
4043 get_allocation_samples_params }, | 4065 get_allocation_samples_params }, |
| 4066 { "_getNativeAllocationSamples", GetNativeAllocationSamples, |
| 4067 get_native_allocation_samples_params }, |
4044 { "getClassList", GetClassList, | 4068 { "getClassList", GetClassList, |
4045 get_class_list_params }, | 4069 get_class_list_params }, |
4046 { "_getCpuProfile", GetCpuProfile, | 4070 { "_getCpuProfile", GetCpuProfile, |
4047 get_cpu_profile_params }, | 4071 get_cpu_profile_params }, |
4048 { "_getCpuProfileTimeline", GetCpuProfileTimeline, | 4072 { "_getCpuProfileTimeline", GetCpuProfileTimeline, |
4049 get_cpu_profile_timeline_params }, | 4073 get_cpu_profile_timeline_params }, |
4050 { "getFlagList", GetFlagList, | 4074 { "getFlagList", GetFlagList, |
4051 get_flag_list_params }, | 4075 get_flag_list_params }, |
4052 { "_getHeapMap", GetHeapMap, | 4076 { "_getHeapMap", GetHeapMap, |
4053 get_heap_map_params }, | 4077 get_heap_map_params }, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4135 if (strcmp(method_name, method.name) == 0) { | 4159 if (strcmp(method_name, method.name) == 0) { |
4136 return &method; | 4160 return &method; |
4137 } | 4161 } |
4138 } | 4162 } |
4139 return NULL; | 4163 return NULL; |
4140 } | 4164 } |
4141 | 4165 |
4142 #endif // !PRODUCT | 4166 #endif // !PRODUCT |
4143 | 4167 |
4144 } // namespace dart | 4168 } // namespace dart |
OLD | NEW |