| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library heap_profile_element; | 5 library heap_profile_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; |
| 9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/service.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 profile = response; | 234 profile = response; |
| 235 }).catchError((e, st) { | 235 }).catchError((e, st) { |
| 236 Logger.root.info('$e $st'); | 236 Logger.root.info('$e $st'); |
| 237 }).whenComplete(done); | 237 }).whenComplete(done); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void resetAccumulator(Event e, var detail, Node target) { | 240 void resetAccumulator(Event e, var detail, Node target) { |
| 241 if (profile == null) { | 241 if (profile == null) { |
| 242 return; | 242 return; |
| 243 } | 243 } |
| 244 profile.isolate.get('/allocationprofile/reset').then((ServiceMap response) { | 244 var isolate = profile.isolate; |
| 245 isolate.get('/allocationprofile?reset=true').then((ServiceMap response) { |
| 245 assert(response['type'] == 'AllocationProfile'); | 246 assert(response['type'] == 'AllocationProfile'); |
| 246 profile = response; | 247 profile = response; |
| 247 }).catchError((e, st) { | 248 }).catchError((e, st) { |
| 248 Logger.root.info('$e $st'); | 249 Logger.root.info('$e $st'); |
| 249 }); | 250 }); |
| 250 } | 251 } |
| 251 | 252 |
| 252 void profileChanged(oldValue) { | 253 void profileChanged(oldValue) { |
| 253 _updateChartData(); | 254 _updateChartData(); |
| 254 notifyPropertyChange(#formattedAverage, [], formattedAverage); | 255 notifyPropertyChange(#formattedAverage, [], formattedAverage); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 278 | 279 |
| 279 @observable String formattedTotalCollectionTime(bool newSpace) { | 280 @observable String formattedTotalCollectionTime(bool newSpace) { |
| 280 if (profile == null) { | 281 if (profile == null) { |
| 281 return ''; | 282 return ''; |
| 282 } | 283 } |
| 283 String space = newSpace ? 'new' : 'old'; | 284 String space = newSpace ? 'new' : 'old'; |
| 284 Map heap = profile['heaps'][space]; | 285 Map heap = profile['heaps'][space]; |
| 285 return '${formatSeconds(heap['time'])} secs'; | 286 return '${formatSeconds(heap['time'])} secs'; |
| 286 } | 287 } |
| 287 } | 288 } |
| OLD | NEW |