| 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 13 matching lines...) Expand all Loading... |
| 24 requestManager = new PostMessageRequestManager(), | 24 requestManager = new PostMessageRequestManager(), |
| 25 isolateManager = new IsolateManager() { | 25 isolateManager = new IsolateManager() { |
| 26 _setup(); | 26 _setup(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ObservatoryApplication() : | 29 ObservatoryApplication() : |
| 30 locationManager = new LocationManager(), | 30 locationManager = new LocationManager(), |
| 31 requestManager = new HttpRequestManager(), | 31 requestManager = new HttpRequestManager(), |
| 32 isolateManager = new IsolateManager() { | 32 isolateManager = new IsolateManager() { |
| 33 _setup(); | 33 _setup(); |
| 34 Logger.root.level = Level.INFO; | |
| 35 Logger.root.onRecord.listen((LogRecord rec) { | |
| 36 print('${rec.level.name}: ${rec.time}: ${rec.message}'); | |
| 37 }); | |
| 38 } | 34 } |
| 39 | 35 |
| 40 /// Return the [Isolate] with [id]. | 36 /// Return the [Isolate] with [id]. |
| 41 Isolate getIsolate(int id) { | 37 Isolate getIsolate(int id) { |
| 42 return isolateManager.isolates[id]; | 38 return isolateManager.isolates[id]; |
| 43 } | 39 } |
| 44 | 40 |
| 45 /// Return the name of the isolate with [id]. | 41 /// Return the name of the isolate with [id]. |
| 46 String getIsolateName(int id) { | 42 String getIsolateName(int id) { |
| 47 var isolate = getIsolate(id); | 43 var isolate = getIsolate(id); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 59 return '${y.toStringAsFixed(1)} MB'; | 55 return '${y.toStringAsFixed(1)} MB'; |
| 60 } else if (x > 2 * KB) { | 56 } else if (x > 2 * KB) { |
| 61 var y = x / KB; | 57 var y = x / KB; |
| 62 return '${y.toStringAsFixed(1)} KB'; | 58 return '${y.toStringAsFixed(1)} KB'; |
| 63 } | 59 } |
| 64 var y = x.toDouble(); | 60 var y = x.toDouble(); |
| 65 return '${y.toStringAsFixed(1)} B'; | 61 return '${y.toStringAsFixed(1)} B'; |
| 66 } | 62 } |
| 67 | 63 |
| 68 static String timeUnits(double x) { | 64 static String timeUnits(double x) { |
| 69 return x.toStringAsFixed(4); | 65 return x.toStringAsFixed(2); |
| 70 } | 66 } |
| 71 } | 67 } |
| OLD | NEW |