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

Unified Diff: runtime/vm/service.cc

Issue 2667743004: Surfaced native heap memory allocation information to the Observatory (Closed)
Patch Set: Added method to check if MallocHooks have been initialized. Created 3 years, 11 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
« no previous file with comments | « runtime/vm/malloc_hooks_unsupported.cc ('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 1a46007c99881f263a8b8f8f9104176ca8643c9a..66c7abec3ac3f98a02ec7d45f701cbc9db47a488 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -16,6 +16,7 @@
#include "vm/debugger.h"
#include "vm/isolate.h"
#include "vm/lockers.h"
+#include "vm/malloc_hooks.h"
#include "vm/message.h"
#include "vm/message_handler.h"
#include "vm/native_entry.h"
@@ -3801,6 +3802,11 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) {
jsobj.AddProperty64("_maxRSS", OS::MaxRSS());
jsobj.AddPropertyTimeMillis(
"startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
+ if (MallocHooks::Initialized()) {
+ jsobj.AddProperty("_heapAllocatedMemoryUsage",
+ MallocHooks::heap_allocated_memory_in_bytes());
+ jsobj.AddProperty("_heapAllocationCount", MallocHooks::allocation_count());
+ }
// Construct the isolate list.
{
JSONArray jsarr(&jsobj, "isolates");
« no previous file with comments | « runtime/vm/malloc_hooks_unsupported.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698