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 | |
3253 static const MethodParameter* clear_cpu_profile_params[] = { | 3231 static const MethodParameter* clear_cpu_profile_params[] = { |
3254 RUNNABLE_ISOLATE_PARAMETER, NULL, | 3232 RUNNABLE_ISOLATE_PARAMETER, NULL, |
3255 }; | 3233 }; |
3256 | 3234 |
3257 | 3235 |
3258 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { | 3236 static bool ClearCpuProfile(Thread* thread, JSONStream* js) { |
3259 ProfilerService::ClearSamples(); | 3237 ProfilerService::ClearSamples(); |
3260 PrintSuccess(js); | 3238 PrintSuccess(js); |
3261 return true; | 3239 return true; |
3262 } | 3240 } |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4065 { "_clearVMTimeline", ClearVMTimeline, | 4043 { "_clearVMTimeline", ClearVMTimeline, |
4066 clear_vm_timeline_params, }, | 4044 clear_vm_timeline_params, }, |
4067 { "evaluate", Evaluate, | 4045 { "evaluate", Evaluate, |
4068 evaluate_params }, | 4046 evaluate_params }, |
4069 { "evaluateInFrame", EvaluateInFrame, | 4047 { "evaluateInFrame", EvaluateInFrame, |
4070 evaluate_in_frame_params }, | 4048 evaluate_in_frame_params }, |
4071 { "_getAllocationProfile", GetAllocationProfile, | 4049 { "_getAllocationProfile", GetAllocationProfile, |
4072 get_allocation_profile_params }, | 4050 get_allocation_profile_params }, |
4073 { "_getAllocationSamples", GetAllocationSamples, | 4051 { "_getAllocationSamples", GetAllocationSamples, |
4074 get_allocation_samples_params }, | 4052 get_allocation_samples_params }, |
4075 { "_getNativeAllocationSamples", GetNativeAllocationSamples, | |
4076 get_native_allocation_samples_params }, | |
4077 { "getClassList", GetClassList, | 4053 { "getClassList", GetClassList, |
4078 get_class_list_params }, | 4054 get_class_list_params }, |
4079 { "_getCpuProfile", GetCpuProfile, | 4055 { "_getCpuProfile", GetCpuProfile, |
4080 get_cpu_profile_params }, | 4056 get_cpu_profile_params }, |
4081 { "_getCpuProfileTimeline", GetCpuProfileTimeline, | 4057 { "_getCpuProfileTimeline", GetCpuProfileTimeline, |
4082 get_cpu_profile_timeline_params }, | 4058 get_cpu_profile_timeline_params }, |
4083 { "getFlagList", GetFlagList, | 4059 { "getFlagList", GetFlagList, |
4084 get_flag_list_params }, | 4060 get_flag_list_params }, |
4085 { "_getHeapMap", GetHeapMap, | 4061 { "_getHeapMap", GetHeapMap, |
4086 get_heap_map_params }, | 4062 get_heap_map_params }, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4168 if (strcmp(method_name, method.name) == 0) { | 4144 if (strcmp(method_name, method.name) == 0) { |
4169 return &method; | 4145 return &method; |
4170 } | 4146 } |
4171 } | 4147 } |
4172 return NULL; | 4148 return NULL; |
4173 } | 4149 } |
4174 | 4150 |
4175 #endif // !PRODUCT | 4151 #endif // !PRODUCT |
4176 | 4152 |
4177 } // namespace dart | 4153 } // namespace dart |
OLD | NEW |