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/app.dart'; | 9 import 'package:observatory/app.dart'; |
10 import 'package:observatory/service.dart'; | 10 import 'package:observatory/service.dart'; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 _classTableBody = shadowRoot.querySelector('#classTableBody'); | 95 _classTableBody = shadowRoot.querySelector('#classTableBody'); |
96 _subscription = app.vm.events.stream.where( | 96 _subscription = app.vm.events.stream.where( |
97 (event) => event.isolate == isolate).listen(_onEvent); | 97 (event) => event.isolate == isolate).listen(_onEvent); |
98 } | 98 } |
99 | 99 |
100 @override | 100 @override |
101 void detached() { | 101 void detached() { |
102 _subscription.cancel((){}); | 102 _subscription.cancel((){}); |
103 super.detached(); | 103 super.detached(); |
104 } | 104 } |
105 | 105 |
106 void _onEvent(ServiceEvent event) { | 106 void _onEvent(ServiceEvent event) { |
107 if (autoRefresh && event.eventType == 'GC') { | 107 if (autoRefresh && event.eventType == 'GC') { |
108 refresh((){}); | 108 refresh((){}); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 void _updatePieCharts() { | 112 void _updatePieCharts() { |
113 assert(profile != null); | 113 assert(profile != null); |
114 _newPieDataTable.clearRows(); | 114 _newPieDataTable.clearRows(); |
115 _newPieDataTable.addRow(['Used', isolate.newSpace.used]); | 115 _newPieDataTable.addRow(['Used', isolate.newSpace.used]); |
116 _newPieDataTable.addRow(['Free', | 116 _newPieDataTable.addRow(['Free', |
117 isolate.newSpace.capacity - isolate.newSpace.used]); | 117 isolate.newSpace.capacity - isolate.newSpace.used]); |
118 _newPieDataTable.addRow(['External', isolate.newSpace.external]); | 118 _newPieDataTable.addRow(['External', isolate.newSpace.external]); |
119 _oldPieDataTable.clearRows(); | 119 _oldPieDataTable.clearRows(); |
120 _oldPieDataTable.addRow(['Used', isolate.oldSpace.used]); | 120 _oldPieDataTable.addRow(['Used', isolate.oldSpace.used]); |
121 _oldPieDataTable.addRow(['Free', | 121 _oldPieDataTable.addRow(['Free', |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 337 } |
338 | 338 |
339 @observable String formattedTotalCollectionTime(bool newSpace) { | 339 @observable String formattedTotalCollectionTime(bool newSpace) { |
340 if (profile == null) { | 340 if (profile == null) { |
341 return ''; | 341 return ''; |
342 } | 342 } |
343 var heap = newSpace ? isolate.newSpace : isolate.oldSpace; | 343 var heap = newSpace ? isolate.newSpace : isolate.oldSpace; |
344 return '${Utils.formatSeconds(heap.totalCollectionTimeInSeconds)} secs'; | 344 return '${Utils.formatSeconds(heap.totalCollectionTimeInSeconds)} secs'; |
345 } | 345 } |
346 } | 346 } |
OLD | NEW |