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

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

Issue 2999933002: Revert "Add current rss and embedder name to Observatory" (Closed)
Patch Set: Created 3 years, 4 months 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
« no previous file with comments | « runtime/vm/service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // TODO(johnmccutchan): Unify embedder service handler lists and their APIs. 102 // TODO(johnmccutchan): Unify embedder service handler lists and their APIs.
103 EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL; 103 EmbedderServiceHandler* Service::isolate_service_handler_head_ = NULL;
104 EmbedderServiceHandler* Service::root_service_handler_head_ = NULL; 104 EmbedderServiceHandler* Service::root_service_handler_head_ = NULL;
105 struct ServiceMethodDescriptor; 105 struct ServiceMethodDescriptor;
106 const ServiceMethodDescriptor* FindMethod(const char* method_name); 106 const ServiceMethodDescriptor* FindMethod(const char* method_name);
107 107
108 // Support for streams defined in embedders. 108 // Support for streams defined in embedders.
109 Dart_ServiceStreamListenCallback Service::stream_listen_callback_ = NULL; 109 Dart_ServiceStreamListenCallback Service::stream_listen_callback_ = NULL;
110 Dart_ServiceStreamCancelCallback Service::stream_cancel_callback_ = NULL; 110 Dart_ServiceStreamCancelCallback Service::stream_cancel_callback_ = NULL;
111 Dart_GetVMServiceAssetsArchive Service::get_service_assets_callback_ = NULL; 111 Dart_GetVMServiceAssetsArchive Service::get_service_assets_callback_ = NULL;
112 Dart_EmbedderInformationCallback Service::embedder_information_callback_ = NULL;
113 112
114 // These are the set of streams known to the core VM. 113 // These are the set of streams known to the core VM.
115 StreamInfo Service::vm_stream("VM"); 114 StreamInfo Service::vm_stream("VM");
116 StreamInfo Service::isolate_stream("Isolate"); 115 StreamInfo Service::isolate_stream("Isolate");
117 StreamInfo Service::debug_stream("Debug"); 116 StreamInfo Service::debug_stream("Debug");
118 StreamInfo Service::gc_stream("GC"); 117 StreamInfo Service::gc_stream("GC");
119 StreamInfo Service::echo_stream("_Echo"); 118 StreamInfo Service::echo_stream("_Echo");
120 StreamInfo Service::graph_stream("_Graph"); 119 StreamInfo Service::graph_stream("_Graph");
121 StreamInfo Service::logging_stream("_Logging"); 120 StreamInfo Service::logging_stream("_Logging");
122 StreamInfo Service::extension_stream("Extension"); 121 StreamInfo Service::extension_stream("Extension");
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 Dart_ServiceStreamCancelCallback cancel_callback) { 1220 Dart_ServiceStreamCancelCallback cancel_callback) {
1222 stream_listen_callback_ = listen_callback; 1221 stream_listen_callback_ = listen_callback;
1223 stream_cancel_callback_ = cancel_callback; 1222 stream_cancel_callback_ = cancel_callback;
1224 } 1223 }
1225 1224
1226 void Service::SetGetServiceAssetsCallback( 1225 void Service::SetGetServiceAssetsCallback(
1227 Dart_GetVMServiceAssetsArchive get_service_assets) { 1226 Dart_GetVMServiceAssetsArchive get_service_assets) {
1228 get_service_assets_callback_ = get_service_assets; 1227 get_service_assets_callback_ = get_service_assets;
1229 } 1228 }
1230 1229
1231 void Service::SetEmbedderInformationCallback(
1232 Dart_EmbedderInformationCallback callback) {
1233 embedder_information_callback_ = callback;
1234 }
1235
1236 int64_t Service::CurrentRSS() {
1237 if (embedder_information_callback_ == NULL) {
1238 return -1;
1239 }
1240 Dart_EmbedderInformation info = {
1241 0, // version
1242 NULL, // name
1243 0, // max_rss
1244 0 // current_rss
1245 };
1246 embedder_information_callback_(&info);
1247 ASSERT(info.version == DART_EMBEDDER_INFORMATION_CURRENT_VERSION);
1248 return info.current_rss;
1249 }
1250
1251 int64_t Service::MaxRSS() {
1252 if (embedder_information_callback_ == NULL) {
1253 return -1;
1254 }
1255 Dart_EmbedderInformation info = {
1256 0, // version
1257 NULL, // name
1258 0, // max_rss
1259 0 // current_rss
1260 };
1261 embedder_information_callback_(&info);
1262 ASSERT(info.version == DART_EMBEDDER_INFORMATION_CURRENT_VERSION);
1263 return info.max_rss;
1264 }
1265
1266 EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) { 1230 EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) {
1267 EmbedderServiceHandler* current = root_service_handler_head_; 1231 EmbedderServiceHandler* current = root_service_handler_head_;
1268 while (current != NULL) { 1232 while (current != NULL) {
1269 if (strcmp(name, current->name()) == 0) { 1233 if (strcmp(name, current->name()) == 0) {
1270 return current; 1234 return current;
1271 } 1235 }
1272 current = current->next(); 1236 current = current->next();
1273 } 1237 }
1274 return NULL; 1238 return NULL;
1275 } 1239 }
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3850 } 3814 }
3851 3815
3852 private: 3816 private:
3853 JSONArray* jsarr_; 3817 JSONArray* jsarr_;
3854 }; 3818 };
3855 3819
3856 static const MethodParameter* get_vm_params[] = { 3820 static const MethodParameter* get_vm_params[] = {
3857 NO_ISOLATE_PARAMETER, NULL, 3821 NO_ISOLATE_PARAMETER, NULL,
3858 }; 3822 };
3859 3823
3860 void Service::PrintJSONForEmbedderInformation(JSONObject *jsobj) {
3861 if (embedder_information_callback_ != NULL) {
3862 Dart_EmbedderInformation info = {
3863 0, // version
3864 NULL, // name
3865 0, // max_rss
3866 0 // current_rss
3867 };
3868 embedder_information_callback_(&info);
3869 ASSERT(info.version == DART_EMBEDDER_INFORMATION_CURRENT_VERSION);
3870 if (info.name != NULL) {
3871 jsobj->AddProperty("_embedder", info.name);
3872 }
3873 if (info.max_rss > 0) {
3874 jsobj->AddProperty64("_maxRSS", info.max_rss);
3875 }
3876 if (info.max_rss > 0) {
3877 jsobj->AddProperty64("_currentRSS", info.current_rss);
3878 }
3879 }
3880 }
3881
3882 void Service::PrintJSONForVM(JSONStream* js, bool ref) { 3824 void Service::PrintJSONForVM(JSONStream* js, bool ref) {
3883 JSONObject jsobj(js); 3825 JSONObject jsobj(js);
3884 jsobj.AddProperty("type", (ref ? "@VM" : "VM")); 3826 jsobj.AddProperty("type", (ref ? "@VM" : "VM"));
3885 jsobj.AddProperty("name", GetVMName()); 3827 jsobj.AddProperty("name", GetVMName());
3886 if (ref) { 3828 if (ref) {
3887 return; 3829 return;
3888 } 3830 }
3889 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); 3831 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord));
3890 jsobj.AddProperty("targetCPU", CPU::Id()); 3832 jsobj.AddProperty("targetCPU", CPU::Id());
3891 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); 3833 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
3892 jsobj.AddProperty("version", Version::String()); 3834 jsobj.AddProperty("version", Version::String());
3893 jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart"); 3835 jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart");
3894 jsobj.AddProperty64("_nativeZoneMemoryUsage", 3836 jsobj.AddProperty64("_nativeZoneMemoryUsage",
3895 ApiNativeScope::current_memory_usage()); 3837 ApiNativeScope::current_memory_usage());
3896 jsobj.AddProperty64("pid", OS::ProcessId()); 3838 jsobj.AddProperty64("pid", OS::ProcessId());
3839 jsobj.AddProperty64("_maxRSS", OS::MaxRSS());
3897 jsobj.AddPropertyTimeMillis( 3840 jsobj.AddPropertyTimeMillis(
3898 "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis()); 3841 "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
3899 MallocHooks::PrintToJSONObject(&jsobj); 3842 MallocHooks::PrintToJSONObject(&jsobj);
3900 PrintJSONForEmbedderInformation(&jsobj);
3901 // Construct the isolate list. 3843 // Construct the isolate list.
3902 { 3844 {
3903 JSONArray jsarr(&jsobj, "isolates"); 3845 JSONArray jsarr(&jsobj, "isolates");
3904 ServiceIsolateVisitor visitor(&jsarr); 3846 ServiceIsolateVisitor visitor(&jsarr);
3905 Isolate::VisitIsolates(&visitor); 3847 Isolate::VisitIsolates(&visitor);
3906 } 3848 }
3907 } 3849 }
3908 3850
3909 static bool GetVM(Thread* thread, JSONStream* js) { 3851 static bool GetVM(Thread* thread, JSONStream* js) {
3910 Service::PrintJSONForVM(js, false); 3852 Service::PrintJSONForVM(js, false);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 if (strcmp(method_name, method.name) == 0) { 4142 if (strcmp(method_name, method.name) == 0) {
4201 return &method; 4143 return &method;
4202 } 4144 }
4203 } 4145 }
4204 return NULL; 4146 return NULL;
4205 } 4147 }
4206 4148
4207 #endif // !PRODUCT 4149 #endif // !PRODUCT
4208 4150
4209 } // namespace dart 4151 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698