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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'package:charted/charted.dart'; | 7 import 'package:charted/charted.dart'; |
8 import "package:charted/charts/charts.dart"; | 8 import "package:charted/charts/charts.dart"; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:observatory/src/elements/class_ref.dart'; | 10 import 'package:observatory/src/elements/class_ref.dart'; |
11 import 'package:observatory/src/elements/containers/virtual_collection.dart'; | 11 import 'package:observatory/src/elements/containers/virtual_collection.dart'; |
| 12 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 13 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 14 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
13 import 'package:observatory/src/elements/helpers/tag.dart'; | 15 import 'package:observatory/src/elements/helpers/tag.dart'; |
14 import 'package:observatory/src/elements/helpers/uris.dart'; | 16 import 'package:observatory/src/elements/helpers/uris.dart'; |
15 import 'package:observatory/src/elements/nav/bar.dart'; | |
16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
17 import 'package:observatory/src/elements/nav/menu.dart'; | |
18 import 'package:observatory/src/elements/nav/notify.dart'; | 18 import 'package:observatory/src/elements/nav/notify.dart'; |
19 import 'package:observatory/src/elements/nav/refresh.dart'; | 19 import 'package:observatory/src/elements/nav/refresh.dart'; |
20 import 'package:observatory/src/elements/nav/top_menu.dart'; | 20 import 'package:observatory/src/elements/nav/top_menu.dart'; |
21 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 21 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
22 import 'package:observatory/utils.dart'; | 22 import 'package:observatory/utils.dart'; |
23 | 23 |
24 enum _SortingField { | 24 enum _SortingField { |
25 accumulatedSize, | 25 accumulatedSize, |
26 accumulatedInstances, | 26 accumulatedInstances, |
27 currentSize, | 27 currentSize, |
(...skipping 11 matching lines...) Expand all Loading... |
39 | 39 |
40 enum _SortingDirection { | 40 enum _SortingDirection { |
41 ascending, | 41 ascending, |
42 descending | 42 descending |
43 } | 43 } |
44 | 44 |
45 class AllocationProfileElement extends HtmlElement implements Renderable { | 45 class AllocationProfileElement extends HtmlElement implements Renderable { |
46 static const tag = const Tag<AllocationProfileElement>('allocation-profile', | 46 static const tag = const Tag<AllocationProfileElement>('allocation-profile', |
47 dependencies: const [ | 47 dependencies: const [ |
48 ClassRefElement.tag, | 48 ClassRefElement.tag, |
49 NavBarElement.tag, | |
50 NavTopMenuElement.tag, | 49 NavTopMenuElement.tag, |
51 NavVMMenuElement.tag, | 50 NavVMMenuElement.tag, |
52 NavIsolateMenuElement.tag, | 51 NavIsolateMenuElement.tag, |
53 NavMenuElement.tag, | |
54 NavRefreshElement.tag, | 52 NavRefreshElement.tag, |
55 NavNotifyElement.tag, | 53 NavNotifyElement.tag, |
56 VirtualCollectionElement.tag | 54 VirtualCollectionElement.tag |
57 ]); | 55 ]); |
58 | 56 |
59 RenderingScheduler<AllocationProfileElement> _r; | 57 RenderingScheduler<AllocationProfileElement> _r; |
60 | 58 |
61 Stream<RenderedEvent<AllocationProfileElement>> get onRendered => | 59 Stream<RenderedEvent<AllocationProfileElement>> get onRendered => |
62 _r.onRendered; | 60 _r.onRendered; |
63 | 61 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 @override | 113 @override |
116 detached() { | 114 detached() { |
117 super.detached(); | 115 super.detached(); |
118 _r.disable(notify: true); | 116 _r.disable(notify: true); |
119 children = []; | 117 children = []; |
120 _gcSubscription.cancel(); | 118 _gcSubscription.cancel(); |
121 } | 119 } |
122 | 120 |
123 void render() { | 121 void render() { |
124 children = [ | 122 children = [ |
125 new NavBarElement(queue: _r.queue) | 123 navBar([ |
126 ..children = [ | 124 new NavTopMenuElement(queue: _r.queue), |
127 new NavTopMenuElement(queue: _r.queue), | 125 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
128 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 126 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
129 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 127 navMenu('allocation profile'), |
130 new NavMenuElement('allocation profile', last: true, | 128 new NavRefreshElement(label: 'Download', disabled: _profile == null, |
131 link: Uris.allocationProfiler(_isolate), queue: _r.queue), | 129 queue: _r.queue) |
132 new NavRefreshElement(label: 'Download', disabled: _profile == null, | 130 ..onRefresh.listen((_) => _downloadCSV()), |
133 queue: _r.queue) | 131 new NavRefreshElement(label: 'Reset Accumulator', queue: _r.queue) |
134 ..onRefresh.listen((_) => _downloadCSV()), | 132 ..onRefresh.listen((_) => _refresh(reset: true)), |
135 new NavRefreshElement(label: 'Reset Accumulator', queue: _r.queue) | 133 new NavRefreshElement(label: 'GC', queue: _r.queue) |
136 ..onRefresh.listen((_) => _refresh(reset: true)), | 134 ..onRefresh.listen((_) => _refresh(gc: true)), |
137 new NavRefreshElement(label: 'GC', queue: _r.queue) | 135 new NavRefreshElement(queue: _r.queue) |
138 ..onRefresh.listen((_) => _refresh(gc: true)), | 136 ..onRefresh.listen((_) => _refresh()), |
139 new NavRefreshElement(queue: _r.queue) | 137 new DivElement()..classes = ['nav-option'] |
140 ..onRefresh.listen((_) => _refresh()), | 138 ..children = [ |
141 new DivElement()..classes = ['nav-option'] | 139 new CheckboxInputElement() |
142 ..children = [ | 140 ..id = 'allocation-profile-auto-refresh' |
143 new CheckboxInputElement() | 141 ..checked = _autoRefresh |
144 ..id = 'allocation-profile-auto-refresh' | 142 ..onChange.listen((_) => _autoRefresh = !_autoRefresh), |
145 ..checked = _autoRefresh | 143 new LabelElement() |
146 ..onChange.listen((_) => _autoRefresh = !_autoRefresh), | 144 ..htmlFor = 'allocation-profile-auto-refresh' |
147 new LabelElement() | 145 ..text = 'Auto-refresh on GC' |
148 ..htmlFor = 'allocation-profile-auto-refresh' | 146 ], |
149 ..text = 'Auto-refresh on GC' | 147 new NavNotifyElement(_notifications, queue: _r.queue) |
150 ], | 148 ]), |
151 new NavNotifyElement(_notifications, queue: _r.queue) | |
152 ], | |
153 new DivElement()..classes = ['content-centered-big'] | 149 new DivElement()..classes = ['content-centered-big'] |
154 ..children = [ | 150 ..children = [ |
155 new HeadingElement.h2()..text = 'Allocation Profile', | 151 new HeadingElement.h2()..text = 'Allocation Profile', |
156 new HRElement() | 152 new HRElement() |
157 ] | 153 ] |
158 ]; | 154 ]; |
159 if (_profile == null) { | 155 if (_profile == null) { |
160 children.addAll([ | 156 children.addAll([ |
161 new DivElement()..classes = ['content-centered-big'] | 157 new DivElement()..classes = ['content-centered-big'] |
162 ..children = [ | 158 ..children = [ |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 s.newSpace.current.instances; | 571 s.newSpace.current.instances; |
576 static int _getOldAccumulatedSize(M.ClassHeapStats s) => | 572 static int _getOldAccumulatedSize(M.ClassHeapStats s) => |
577 s.oldSpace.accumulated.bytes; | 573 s.oldSpace.accumulated.bytes; |
578 static int _getOldAccumulatedInstances(M.ClassHeapStats s) => | 574 static int _getOldAccumulatedInstances(M.ClassHeapStats s) => |
579 s.oldSpace.accumulated.instances; | 575 s.oldSpace.accumulated.instances; |
580 static int _getOldCurrentSize(M.ClassHeapStats s) => | 576 static int _getOldCurrentSize(M.ClassHeapStats s) => |
581 s.oldSpace.current.bytes; | 577 s.oldSpace.current.bytes; |
582 static int _getOldCurrentInstances(M.ClassHeapStats s) => | 578 static int _getOldCurrentInstances(M.ClassHeapStats s) => |
583 s.oldSpace.current.instances; | 579 s.oldSpace.current.instances; |
584 } | 580 } |
OLD | NEW |