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

Unified Diff: runtime/vm/service.cc

Issue 2996803002: Add current rss and embedder name to Observatory (Closed)
Patch Set: Managing null currentRSS in graph tooltip 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 side-by-side diff with in-line comments
Download patch
« runtime/include/dart_tools_api.h ('K') | « runtime/vm/service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index f1614693021c5bbd79e46725777524b60c56b634..6a0bd6d9b4026ce06173c785f70eba22427c89a9 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -108,6 +108,7 @@ const ServiceMethodDescriptor* FindMethod(const char* method_name);
Dart_ServiceStreamListenCallback Service::stream_listen_callback_ = NULL;
Dart_ServiceStreamCancelCallback Service::stream_cancel_callback_ = NULL;
Dart_GetVMServiceAssetsArchive Service::get_service_assets_callback_ = NULL;
+Dart_GetEmbedderInformation Service::get_embedder_information_callback_ = NULL;
// These are the set of streams known to the core VM.
StreamInfo Service::vm_stream("VM");
@@ -1226,6 +1227,25 @@ void Service::SetGetServiceAssetsCallback(
get_service_assets_callback_ = get_service_assets;
}
+void Service::SetGetEmbedderInformationCallback(
+ Dart_GetEmbedderInformation get_embedder_information) {
+ get_embedder_information_callback_ = get_embedder_information;
+}
+
+int64_t Service::CurrentRSS() {
+ if (get_embedder_information_callback_ == NULL) {
+ return -1;
+ }
+ return get_embedder_information_callback_()->current_rss;
+}
+
+int64_t Service::MaxRSS() {
+ if (get_embedder_information_callback_ == NULL) {
+ return -1;
+ }
+ return get_embedder_information_callback_()->max_rss;
+}
+
EmbedderServiceHandler* Service::FindRootEmbedderHandler(const char* name) {
EmbedderServiceHandler* current = root_service_handler_head_;
while (current != NULL) {
@@ -3822,7 +3842,19 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) {
jsobj.AddProperty64("_nativeZoneMemoryUsage",
ApiNativeScope::current_memory_usage());
jsobj.AddProperty64("pid", OS::ProcessId());
- jsobj.AddProperty64("_maxRSS", OS::MaxRSS());
+ if (get_embedder_information_callback_ != NULL) {
+ const Dart_EmbedderInformation* info = get_embedder_information_callback_();
+ ASSERT(info != NULL);
+ if (info->name != NULL) {
+ jsobj.AddProperty("_embedder", info->name);
+ }
+ if (info->max_rss > 0) {
+ jsobj.AddProperty64("_maxRSS", info->max_rss);
+ }
+ if (info->max_rss > 0) {
+ jsobj.AddProperty64("_currentRSS", info->current_rss);
+ }
+ }
jsobj.AddPropertyTimeMillis(
"startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
MallocHooks::PrintToJSONObject(&jsobj);
« runtime/include/dart_tools_api.h ('K') | « runtime/vm/service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698