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 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); | 3221 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); |
3222 ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros, | 3222 ProfilerService::PrintAllocationJSON(js, tag_order, cls, time_origin_micros, |
3223 time_extent_micros); | 3223 time_extent_micros); |
3224 } else { | 3224 } else { |
3225 PrintInvalidParamError(js, "classId"); | 3225 PrintInvalidParamError(js, "classId"); |
3226 } | 3226 } |
3227 return true; | 3227 return true; |
3228 } | 3228 } |
3229 | 3229 |
3230 | 3230 |
| 3231 static const MethodParameter* get_native_allocation_samples_params[] = { |
| 3232 NO_ISOLATE_PARAMETER, |
| 3233 new EnumParameter("tags", true, tags_enum_names), |
| 3234 new Int64Parameter("timeOriginMicros", false), |
| 3235 new Int64Parameter("timeExtentMicros", false), |
| 3236 NULL, |
| 3237 }; |
| 3238 |
| 3239 |
| 3240 static bool GetNativeAllocationSamples(Thread* thread, JSONStream* js) { |
| 3241 Profile::TagOrder tag_order = |
| 3242 EnumMapper(js->LookupParam("tags"), tags_enum_names, tags_enum_values); |
| 3243 int64_t time_origin_micros = |
| 3244 Int64Parameter::Parse(js->LookupParam("timeOriginMicros")); |
| 3245 int64_t time_extent_micros = |
| 3246 Int64Parameter::Parse(js->LookupParam("timeExtentMicros")); |
| 3247 ProfilerService::PrintNativeAllocationJSON(js, tag_order, time_origin_micros, |
| 3248 time_extent_micros); |
| 3249 return true; |
| 3250 } |
| 3251 |
| 3252 |
3231 static const MethodParameter* clear_cpu_profile_params[] = { | 3253 static const MethodParameter* clear_cpu_profile_params[] = { |
3232 RUNNABLE_ISOLATE_PARAMETER, NULL, | 3254 RUNNABLE_ISOLATE_PARAMETER, NULL, |
3233 }; | 3255 }; |
3234 | 3256 |
3235 | 3257 |
3236 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { | 3258 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { |
3237 ProfilerService::ClearSamples(); | 3259 ProfilerService::ClearSamples(); |
3238 PrintSuccess(js); | 3260 PrintSuccess(js); |
3239 return true; | 3261 return true; |
3240 } | 3262 } |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4043 { "_clearVMTimeline", ClearVMTimeline, | 4065 { "_clearVMTimeline", ClearVMTimeline, |
4044 clear_vm_timeline_params, }, | 4066 clear_vm_timeline_params, }, |
4045 { "evaluate", Evaluate, | 4067 { "evaluate", Evaluate, |
4046 evaluate_params }, | 4068 evaluate_params }, |
4047 { "evaluateInFrame", EvaluateInFrame, | 4069 { "evaluateInFrame", EvaluateInFrame, |
4048 evaluate_in_frame_params }, | 4070 evaluate_in_frame_params }, |
4049 { "_getAllocationProfile", GetAllocationProfile, | 4071 { "_getAllocationProfile", GetAllocationProfile, |
4050 get_allocation_profile_params }, | 4072 get_allocation_profile_params }, |
4051 { "_getAllocationSamples", GetAllocationSamples, | 4073 { "_getAllocationSamples", GetAllocationSamples, |
4052 get_allocation_samples_params }, | 4074 get_allocation_samples_params }, |
| 4075 { "_getNativeAllocationSamples", GetNativeAllocationSamples, |
| 4076 get_native_allocation_samples_params }, |
4053 { "getClassList", GetClassList, | 4077 { "getClassList", GetClassList, |
4054 get_class_list_params }, | 4078 get_class_list_params }, |
4055 { "_getCpuProfile", GetCpuProfile, | 4079 { "_getCpuProfile", GetCpuProfile, |
4056 get_cpu_profile_params }, | 4080 get_cpu_profile_params }, |
4057 { "_getCpuProfileTimeline", GetCpuProfileTimeline, | 4081 { "_getCpuProfileTimeline", GetCpuProfileTimeline, |
4058 get_cpu_profile_timeline_params }, | 4082 get_cpu_profile_timeline_params }, |
4059 { "getFlagList", GetFlagList, | 4083 { "getFlagList", GetFlagList, |
4060 get_flag_list_params }, | 4084 get_flag_list_params }, |
4061 { "_getHeapMap", GetHeapMap, | 4085 { "_getHeapMap", GetHeapMap, |
4062 get_heap_map_params }, | 4086 get_heap_map_params }, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4144 if (strcmp(method_name, method.name) == 0) { | 4168 if (strcmp(method_name, method.name) == 0) { |
4145 return &method; | 4169 return &method; |
4146 } | 4170 } |
4147 } | 4171 } |
4148 return NULL; | 4172 return NULL; |
4149 } | 4173 } |
4150 | 4174 |
4151 #endif // !PRODUCT | 4175 #endif // !PRODUCT |
4152 | 4176 |
4153 } // namespace dart | 4177 } // namespace dart |
OLD | NEW |