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

Unified Diff: runtime/vm/zone.h

Issue 2554983002: Created methods to surface zone memory information for each isolate and thread in JSON. (Closed)
Patch Set: Created methods to surface zone memory information for each isolate and thread in JSON. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread_test.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone.h
diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h
index 4e2e8a91e182a2f1cf8a012a687fc725ca816289..9cf29714e29bd2de0f39200fbfd78f485a5ed646 100644
--- a/runtime/vm/zone.h
+++ b/runtime/vm/zone.h
@@ -8,6 +8,7 @@
#include "platform/utils.h"
#include "vm/allocation.h"
#include "vm/handles.h"
+#include "vm/json_stream.h"
#include "vm/thread.h"
#include "vm/memory_region.h"
@@ -65,6 +66,11 @@ class Zone {
// due to internal fragmentation in the segments.
intptr_t SizeInBytes() const;
+ // Computes the amount of space used in the zone.
+ intptr_t UsedSizeInBytes() const {
+ return SizeInBytes() - (limit_ - position_);
+ }
+
// Structure for managing handles allocation.
VMHandles* handles() { return &handles_; }
@@ -72,6 +78,10 @@ class Zone {
Zone* previous() const { return previous_; }
+#ifndef PRODUCT
+ void PrintJSON(JSONStream* stream) const;
+#endif
+
private:
Zone();
~Zone(); // Delete all memory associated with the zone.
@@ -174,6 +184,9 @@ class StackZone : public StackResource {
// due to internal fragmentation in the segments.
intptr_t SizeInBytes() const { return zone_.SizeInBytes(); }
+ // Computes the used space in the zone.
+ intptr_t UsedSizeInBytes() const { return zone_.UsedSizeInBytes(); }
+
Zone* GetZone() { return &zone_; }
private:
« no previous file with comments | « runtime/vm/thread_test.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698