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

Side by Side 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 unified diff | Download patch
« runtime/vm/zone.cc ('K') | « runtime/vm/zone.cc ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/dart.h" 6 #include "vm/dart.h"
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 #include "vm/zone.h" 9 #include "vm/zone.h"
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 zone.CapacityInBytes(), zone.SizeInBytes()); 221 zone.CapacityInBytes(), zone.SizeInBytes());
222 EXPECT_LE(zone.SizeInBytes(), zone.CapacityInBytes()); 222 EXPECT_LE(zone.SizeInBytes(), zone.CapacityInBytes());
223 EXPECT_SUBSTRING(size_buf, json); 223 EXPECT_SUBSTRING(size_buf, json);
224 } 224 }
225 } 225 }
226 EXPECT(thread->zone() == NULL); 226 EXPECT(thread->zone() == NULL);
227 Dart_ShutdownIsolate(); 227 Dart_ShutdownIsolate();
228 } 228 }
229 #endif 229 #endif
230 230
231
232 UNIT_TEST_CASE(NativeScopeZoneAllocation) {
233 ASSERT(ApiNativeScope::Current() == NULL);
234 ASSERT(Thread::Current() == NULL);
235 EXPECT_EQ(0, ApiNativeScope::current_memory_usage());
236 {
237 ApiNativeScope scope;
238 EXPECT_EQ(scope.zone()->CapacityInBytes(),
239 ApiNativeScope::current_memory_usage());
240 (void)Dart_ScopeAllocate(2048);
241 EXPECT_EQ(scope.zone()->CapacityInBytes(),
242 ApiNativeScope::current_memory_usage());
243 }
244 EXPECT_EQ(0, ApiNativeScope::current_memory_usage());
245 }
246
231 } // namespace dart 247 } // namespace dart
OLDNEW
« 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