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 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
9 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
10 import 'observatory_element.dart'; | 10 import 'observatory_element.dart'; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 v['old'][ALLOCATED_SINCE_GC_SIZE]; | 215 v['old'][ALLOCATED_SINCE_GC_SIZE]; |
216 case 5: | 216 case 5: |
217 return v['new'][ALLOCATED_BEFORE_GC_SIZE] + | 217 return v['new'][ALLOCATED_BEFORE_GC_SIZE] + |
218 v['old'][ALLOCATED_BEFORE_GC_SIZE]; | 218 v['old'][ALLOCATED_BEFORE_GC_SIZE]; |
219 case 6: | 219 case 6: |
220 return v['new'][LIVE_AFTER_GC_SIZE] + v['old'][LIVE_AFTER_GC_SIZE]; | 220 return v['new'][LIVE_AFTER_GC_SIZE] + v['old'][LIVE_AFTER_GC_SIZE]; |
221 } | 221 } |
222 throw new FallThroughError(); | 222 throw new FallThroughError(); |
223 } | 223 } |
224 | 224 |
225 void refreshData(Event e, var detail, Node target) { | 225 void refresh(var done) { |
226 var isolateId = app.locationManager.currentIsolateId(); | 226 var isolateId = app.locationManager.currentIsolateId(); |
227 var isolate = app.isolateManager.getIsolate(isolateId); | 227 var isolate = app.isolateManager.getIsolate(isolateId); |
228 if (isolate == null) { | 228 if (isolate == null) { |
229 Logger.root.info('No isolate found.'); | 229 Logger.root.info('No isolate found.'); |
230 return; | 230 return; |
231 } | 231 } |
232 var request = '/$isolateId/allocationprofile'; | 232 var request = '/$isolateId/allocationprofile'; |
233 app.requestManager.requestMap(request).then((Map response) { | 233 app.requestManager.requestMap(request).then((Map response) { |
234 assert(response['type'] == 'AllocationProfile'); | 234 assert(response['type'] == 'AllocationProfile'); |
235 profile = response; | 235 profile = response; |
236 }).catchError((e, st) { | 236 }).catchError((e, st) { |
237 Logger.root.info('$e $st'); | 237 Logger.root.info('$e $st'); |
238 }); | 238 }).whenComplete(done); |
239 } | 239 } |
240 | 240 |
241 void resetAccumulator(Event e, var detail, Node target) { | 241 void resetAccumulator(Event e, var detail, Node target) { |
242 var isolateId = app.locationManager.currentIsolateId(); | 242 var isolateId = app.locationManager.currentIsolateId(); |
243 var isolate = app.isolateManager.getIsolate(isolateId); | 243 var isolate = app.isolateManager.getIsolate(isolateId); |
244 if (isolate == null) { | 244 if (isolate == null) { |
245 Logger.root.info('No isolate found.'); | 245 Logger.root.info('No isolate found.'); |
246 return; | 246 return; |
247 } | 247 } |
248 var request = '/$isolateId/allocationprofile/reset'; | 248 var request = '/$isolateId/allocationprofile/reset'; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 @observable String formattedTotalCollectionTime(bool newSpace) { | 284 @observable String formattedTotalCollectionTime(bool newSpace) { |
285 if (profile == null) { | 285 if (profile == null) { |
286 return ''; | 286 return ''; |
287 } | 287 } |
288 String space = newSpace ? 'new' : 'old'; | 288 String space = newSpace ? 'new' : 'old'; |
289 Map heap = profile['heaps'][space]; | 289 Map heap = profile['heaps'][space]; |
290 return '${ObservatoryApplication.timeUnits(heap['time'])} secs'; | 290 return '${ObservatoryApplication.timeUnits(heap['time'])} secs'; |
291 } | 291 } |
292 } | 292 } |
OLD | NEW |