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

Unified Diff: runtime/vm/zone_test.cc

Issue 2650583014: Added tracking of memory usage within ApiNativeScopes. Usage to be displayed within Observatory. (Closed)
Patch Set: Added unit test + fixed typo 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
« runtime/vm/zone.cc ('K') | « runtime/vm/zone.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone_test.cc
diff --git a/runtime/vm/zone_test.cc b/runtime/vm/zone_test.cc
index ba0a25b188c922647cdcb3ba0896a6849aecaa13..21b50c0076cd2c4efc69e2011678f226092c406c 100644
--- a/runtime/vm/zone_test.cc
+++ b/runtime/vm/zone_test.cc
@@ -228,4 +228,20 @@ UNIT_TEST_CASE(PrintZoneMemoryInfoToJSON) {
}
#endif
+
+UNIT_TEST_CASE(NativeScopeZoneAllocation) {
+ ASSERT(ApiNativeScope::Current() == NULL);
+ ASSERT(Thread::Current() == NULL);
+ EXPECT_EQ(0, ApiNativeScope::current_memory_usage());
+ {
+ ApiNativeScope scope;
+ EXPECT_EQ(scope.zone()->CapacityInBytes(),
+ ApiNativeScope::current_memory_usage());
+ (void)Dart_ScopeAllocate(2048);
+ EXPECT_EQ(scope.zone()->CapacityInBytes(),
+ ApiNativeScope::current_memory_usage());
+ }
+ EXPECT_EQ(0, ApiNativeScope::current_memory_usage());
+}
+
} // namespace dart
« runtime/vm/zone.cc ('K') | « runtime/vm/zone.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698