OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of observatory; | 5 part of observatory; |
6 | 6 |
7 /// The observatory application. Instances of this are created and owned | 7 /// The observatory application. Instances of this are created and owned |
8 /// by the observatory_application custom element. | 8 /// by the observatory_application custom element. |
9 class ObservatoryApplication extends Observable { | 9 class ObservatoryApplication extends Observable { |
10 @observable final LocationManager locationManager; | 10 @observable final LocationManager locationManager; |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 /// Return the name of the isolate with [id]. | 41 /// Return the name of the isolate with [id]. |
42 String getIsolateName(int id) { | 42 String getIsolateName(int id) { |
43 var isolate = getIsolate(id); | 43 var isolate = getIsolate(id); |
44 if (isolate == null) { | 44 if (isolate == null) { |
45 return 'Null Isolate'; | 45 return 'Null Isolate'; |
46 } | 46 } |
47 return isolate.name; | 47 return isolate.name; |
48 } | 48 } |
| 49 |
| 50 static const int KB = 1024; |
| 51 static const int MB = KB * 1024; |
| 52 static String scaledSizeUnits(int x) { |
| 53 if (x > 2 * MB) { |
| 54 var y = x / MB; |
| 55 return '${y.toStringAsFixed(1)} MB'; |
| 56 } else if (x > 2 * KB) { |
| 57 var y = x / KB; |
| 58 return '${y.toStringAsFixed(1)} KB'; |
| 59 } |
| 60 var y = x.toDouble(); |
| 61 return '${y.toStringAsFixed(1)} B'; |
| 62 } |
| 63 |
| 64 static String timeUnits(double x) { |
| 65 return x.toStringAsFixed(4); |
| 66 } |
49 } | 67 } |
OLD | NEW |