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

Unified Diff: runtime/bin/vmservice/client/lib/src/observatory/application.dart

Issue 51653006: Track live instance and allocation counts for classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
Index: runtime/bin/vmservice/client/lib/src/observatory/application.dart
diff --git a/runtime/bin/vmservice/client/lib/src/observatory/application.dart b/runtime/bin/vmservice/client/lib/src/observatory/application.dart
index 21eae05e246c9a5656f24f803fbefecece91f62e..1c491ea14dbe9a7778156d3064fde3f450d375fa 100644
--- a/runtime/bin/vmservice/client/lib/src/observatory/application.dart
+++ b/runtime/bin/vmservice/client/lib/src/observatory/application.dart
@@ -50,4 +50,22 @@ class ObservatoryApplication extends Observable {
}
return isolate.name;
}
+
+ static const int KB = 1024;
+ static const int MB = KB * 1024;
+ static String scaledSizeUnits(int x) {
+ if (x > 2 * MB) {
+ var y = x / MB;
+ return '${y.toStringAsFixed(1)} MB';
+ } else if (x > 2 * KB) {
+ var y = x / KB;
+ return '${y.toStringAsFixed(1)} KB';
+ }
+ var y = x.toDouble();
+ return '${y.toStringAsFixed(1)} B';
+ }
+
+ static String timeUnits(double x) {
+ return x.toStringAsFixed(4);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698