| 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:async'; | |
| 8 import 'dart:html'; | 7 import 'dart:html'; |
| 9 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
| 10 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 11 import 'observatory_element.dart'; | 10 import 'observatory_element.dart'; |
| 12 | 11 |
| 13 /// Displays an Error response. | 12 /// Displays an Error response. |
| 14 @CustomTag('heap-profile') | 13 @CustomTag('heap-profile') |
| 15 class HeapProfileElement extends ObservatoryElement { | 14 class HeapProfileElement extends ObservatoryElement { |
| 16 // Indexes into VM provided map. | 15 // Indexes into VM provided map. |
| 17 static const ALLOCATED_BEFORE_GC = 0; | 16 static const ALLOCATED_BEFORE_GC = 0; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return v['new'][LIVE_AFTER_GC_SIZE]; | 125 return v['new'][LIVE_AFTER_GC_SIZE]; |
| 127 case 5: | 126 case 5: |
| 128 return v['old'][LIVE_AFTER_GC_SIZE] + v['old'][ALLOCATED_SINCE_GC_SIZE]; | 127 return v['old'][LIVE_AFTER_GC_SIZE] + v['old'][ALLOCATED_SINCE_GC_SIZE]; |
| 129 case 6: | 128 case 6: |
| 130 return v['old'][ALLOCATED_SINCE_GC_SIZE]; | 129 return v['old'][ALLOCATED_SINCE_GC_SIZE]; |
| 131 case 7: | 130 case 7: |
| 132 return v['old'][ALLOCATED_BEFORE_GC_SIZE]; | 131 return v['old'][ALLOCATED_BEFORE_GC_SIZE]; |
| 133 case 8: | 132 case 8: |
| 134 return v['old'][LIVE_AFTER_GC_SIZE]; | 133 return v['old'][LIVE_AFTER_GC_SIZE]; |
| 135 } | 134 } |
| 135 return null; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void refreshData(Event e, var detail, Node target) { | 138 void refreshData(Event e, var detail, Node target) { |
| 139 var isolateId = app.locationManager.currentIsolateId(); | 139 var isolateId = app.locationManager.currentIsolateId(); |
| 140 var isolate = app.isolateManager.getIsolate(isolateId); | 140 var isolate = app.isolateManager.getIsolate(isolateId); |
| 141 if (isolate == null) { | 141 if (isolate == null) { |
| 142 Logger.root.info('No isolate found.'); | 142 Logger.root.info('No isolate found.'); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 var request = '/$isolateId/allocationprofile'; | 145 var request = '/$isolateId/allocationprofile'; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 @observable String formattedTotalCollectionTime(bool newSpace) { | 181 @observable String formattedTotalCollectionTime(bool newSpace) { |
| 182 if (profile == null) { | 182 if (profile == null) { |
| 183 return ''; | 183 return ''; |
| 184 } | 184 } |
| 185 String space = newSpace ? 'new' : 'old'; | 185 String space = newSpace ? 'new' : 'old'; |
| 186 Map heap = profile['heaps'][space]; | 186 Map heap = profile['heaps'][space]; |
| 187 return '${ObservatoryApplication.timeUnits(heap['time'])} secs'; | 187 return '${ObservatoryApplication.timeUnits(heap['time'])} secs'; |
| 188 } | 188 } |
| 189 } | 189 } |
| OLD | NEW |