Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: runtime/vm/service.cc

Issue 2574643003: Added ability to request zone memory information for all isolates through the VM service and added … (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 return true; 2939 return true;
2940 } 2940 }
2941 Isolate* isolate = thread->isolate(); 2941 Isolate* isolate = thread->isolate();
2942 ASSERT(isolate != NULL); 2942 ASSERT(isolate != NULL);
2943 StackZone zone(thread); 2943 StackZone zone(thread);
2944 Timeline::PrintFlagsToJSON(js); 2944 Timeline::PrintFlagsToJSON(js);
2945 return true; 2945 return true;
2946 } 2946 }
2947 2947
2948 2948
2949 class ServiceIsolateVisitor : public IsolateVisitor {
2950 public:
2951 explicit ServiceIsolateVisitor(JSONArray* jsarr, bool ref = true)
zra 2016/12/13 23:37:02 Since there are still only a small number of uses
bkonyi 2016/12/13 23:48:45 Done.
2952 : jsarr_(jsarr), ref_(ref) {}
2953 virtual ~ServiceIsolateVisitor() {}
2954
2955 void VisitIsolate(Isolate* isolate) {
2956 if (!IsVMInternalIsolate(isolate)) {
2957 jsarr_->AddValue(isolate, ref_);
2958 }
2959 }
2960
2961 private:
2962 JSONArray* jsarr_;
2963 bool ref_;
2964 };
2965
2966
2967 static const MethodParameter* get_zone_memory_info_params[] = {
2968 NO_ISOLATE_PARAMETER, NULL,
2969 };
2970
2971
2972 static bool GetZoneMemoryInfo(Thread* thread, JSONStream* js) {
Cutch 2016/12/14 17:18:15 This is the same as getVM but with the full Isolat
2973 JSONObject jsobj(js);
2974 jsobj.AddProperty("type", "_ZoneMemoryInfo");
bkonyi 2016/12/13 22:37:48 There's probably a better name for this type, but
zra 2016/12/13 23:37:02 _AllIsolatesInfo? Not sure if this matches with th
2975 {
2976 JSONArray jsarr(&jsobj, "isolates");
2977 ServiceIsolateVisitor visitor(&jsarr, false);
2978 Isolate::VisitIsolates(&visitor);
2979 }
2980 return true;
2981 }
2982
2983
2949 static const MethodParameter* clear_vm_timeline_params[] = { 2984 static const MethodParameter* clear_vm_timeline_params[] = {
2950 NO_ISOLATE_PARAMETER, NULL, 2985 NO_ISOLATE_PARAMETER, NULL,
2951 }; 2986 };
2952 2987
2953 2988
2954 static bool ClearVMTimeline(Thread* thread, JSONStream* js) { 2989 static bool ClearVMTimeline(Thread* thread, JSONStream* js) {
2955 Isolate* isolate = thread->isolate(); 2990 Isolate* isolate = thread->isolate();
2956 ASSERT(isolate != NULL); 2991 ASSERT(isolate != NULL);
2957 StackZone zone(thread); 2992 StackZone zone(thread);
2958 2993
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 jsobj.AddProperty("major", 3784 jsobj.AddProperty("major",
3750 static_cast<intptr_t>(SERVICE_PROTOCOL_MAJOR_VERSION)); 3785 static_cast<intptr_t>(SERVICE_PROTOCOL_MAJOR_VERSION));
3751 jsobj.AddProperty("minor", 3786 jsobj.AddProperty("minor",
3752 static_cast<intptr_t>(SERVICE_PROTOCOL_MINOR_VERSION)); 3787 static_cast<intptr_t>(SERVICE_PROTOCOL_MINOR_VERSION));
3753 jsobj.AddProperty("_privateMajor", static_cast<intptr_t>(0)); 3788 jsobj.AddProperty("_privateMajor", static_cast<intptr_t>(0));
3754 jsobj.AddProperty("_privateMinor", static_cast<intptr_t>(0)); 3789 jsobj.AddProperty("_privateMinor", static_cast<intptr_t>(0));
3755 return true; 3790 return true;
3756 } 3791 }
3757 3792
3758 3793
3759 class ServiceIsolateVisitor : public IsolateVisitor {
3760 public:
3761 explicit ServiceIsolateVisitor(JSONArray* jsarr) : jsarr_(jsarr) {}
3762 virtual ~ServiceIsolateVisitor() {}
3763
3764 void VisitIsolate(Isolate* isolate) {
3765 if (!IsVMInternalIsolate(isolate)) {
3766 jsarr_->AddValue(isolate);
3767 }
3768 }
3769
3770 private:
3771 JSONArray* jsarr_;
3772 };
3773
3774
3775 static const MethodParameter* get_vm_params[] = { 3794 static const MethodParameter* get_vm_params[] = {
3776 NO_ISOLATE_PARAMETER, NULL, 3795 NO_ISOLATE_PARAMETER, NULL,
3777 }; 3796 };
3778 3797
3779 3798
3780 void Service::PrintJSONForVM(JSONStream* js, bool ref) { 3799 void Service::PrintJSONForVM(JSONStream* js, bool ref) {
3781 JSONObject jsobj(js); 3800 JSONObject jsobj(js);
3782 jsobj.AddProperty("type", (ref ? "@VM" : "VM")); 3801 jsobj.AddProperty("type", (ref ? "@VM" : "VM"));
3783 jsobj.AddProperty("name", GetVMName()); 3802 jsobj.AddProperty("name", GetVMName());
3784 if (ref) { 3803 if (ref) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
4078 { "getVM", GetVM, 4097 { "getVM", GetVM,
4079 get_vm_params }, 4098 get_vm_params },
4080 { "_getVMMetric", GetVMMetric, 4099 { "_getVMMetric", GetVMMetric,
4081 get_vm_metric_params }, 4100 get_vm_metric_params },
4082 { "_getVMMetricList", GetVMMetricList, 4101 { "_getVMMetricList", GetVMMetricList,
4083 get_vm_metric_list_params }, 4102 get_vm_metric_list_params },
4084 { "_getVMTimeline", GetVMTimeline, 4103 { "_getVMTimeline", GetVMTimeline,
4085 get_vm_timeline_params }, 4104 get_vm_timeline_params },
4086 { "_getVMTimelineFlags", GetVMTimelineFlags, 4105 { "_getVMTimelineFlags", GetVMTimelineFlags,
4087 get_vm_timeline_flags_params }, 4106 get_vm_timeline_flags_params },
4107 { "_getZoneMemoryInfo", GetZoneMemoryInfo,
bkonyi 2016/12/13 22:37:48 I'm not sure if this is the best name since what's
zra 2016/12/13 23:37:02 If there isn't already something like that, then t
4108 get_zone_memory_info_params },
4088 { "pause", Pause, 4109 { "pause", Pause,
4089 pause_params }, 4110 pause_params },
4090 { "removeBreakpoint", RemoveBreakpoint, 4111 { "removeBreakpoint", RemoveBreakpoint,
4091 remove_breakpoint_params }, 4112 remove_breakpoint_params },
4092 { "_restartVM", RestartVM, 4113 { "_restartVM", RestartVM,
4093 restart_vm_params }, 4114 restart_vm_params },
4094 { "reloadSources", ReloadSources, 4115 { "reloadSources", ReloadSources,
4095 reload_sources_params }, 4116 reload_sources_params },
4096 { "_reloadSources", ReloadSources, 4117 { "_reloadSources", ReloadSources,
4097 reload_sources_params }, 4118 reload_sources_params },
(...skipping 25 matching lines...) Expand all
4123 if (strcmp(method_name, method.name) == 0) { 4144 if (strcmp(method_name, method.name) == 0) {
4124 return &method; 4145 return &method;
4125 } 4146 }
4126 } 4147 }
4127 return NULL; 4148 return NULL;
4128 } 4149 }
4129 4150
4130 #endif // !PRODUCT 4151 #endif // !PRODUCT
4131 4152
4132 } // namespace dart 4153 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698