Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Side by Side Diff: runtime/observatory/lib/src/elements/class_view.dart

Issue 1851293005: Improve CPU Profile View (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 class_view_element; 5 library class_view_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'observatory_element.dart'; 8 import 'observatory_element.dart';
9 import 'package:observatory/cpu_profile.dart'; 9 import 'package:observatory/cpu_profile.dart';
10 import 'package:observatory/elements.dart'; 10 import 'package:observatory/elements.dart';
11 import 'package:observatory/service.dart'; 11 import 'package:observatory/service.dart';
12 import 'package:polymer/polymer.dart'; 12 import 'package:polymer/polymer.dart';
13 13
14 @CustomTag('class-view') 14 @CustomTag('class-view')
15 class ClassViewElement extends ObservatoryElement { 15 class ClassViewElement extends ObservatoryElement {
16 @published Class cls; 16 @published Class cls;
17 @observable ServiceMap instances; 17 @observable ServiceMap instances;
18 @observable int reachableBytes; 18 @observable int reachableBytes;
19 @observable int retainedBytes; 19 @observable int retainedBytes;
20 @observable ObservableList mostRetained; 20 @observable ObservableList mostRetained;
21 SampleBufferControlElement sampleBufferControlElement; 21 SampleBufferControlElement sampleBufferControlElement;
22 StackTraceTreeConfigElement stackTraceTreeConfigElement; 22 StackTraceTreeConfigElement stackTraceTreeConfigElement;
23 CpuProfileTreeElement cpuProfileTreeElement; 23 CpuProfileVirtualTreeElement cpuProfileTreeElement;
24 24
25 ClassViewElement.created() : super.created(); 25 ClassViewElement.created() : super.created();
26 26
27 Future<ServiceObject> evaluate(String expression) { 27 Future<ServiceObject> evaluate(String expression) {
28 return cls.evaluate(expression); 28 return cls.evaluate(expression);
29 } 29 }
30 30
31 Future<ServiceObject> reachable(var limit) { 31 Future<ServiceObject> reachable(var limit) {
32 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) { 32 return cls.isolate.getInstances(cls, limit).then((ServiceMap obj) {
33 instances = obj; 33 instances = obj;
(...skipping 29 matching lines...) Expand all
63 shadowRoot.querySelector('#sampleBufferControl'); 63 shadowRoot.querySelector('#sampleBufferControl');
64 assert(sampleBufferControlElement != null); 64 assert(sampleBufferControlElement != null);
65 sampleBufferControlElement.onSampleBufferUpdate = onSampleBufferChange; 65 sampleBufferControlElement.onSampleBufferUpdate = onSampleBufferChange;
66 sampleBufferControlElement.state = 66 sampleBufferControlElement.state =
67 SampleBufferControlElement.kNotLoadedState; 67 SampleBufferControlElement.kNotLoadedState;
68 stackTraceTreeConfigElement = 68 stackTraceTreeConfigElement =
69 shadowRoot.querySelector('#stackTraceTreeConfig'); 69 shadowRoot.querySelector('#stackTraceTreeConfig');
70 assert(stackTraceTreeConfigElement != null); 70 assert(stackTraceTreeConfigElement != null);
71 stackTraceTreeConfigElement.onTreeConfigChange = onTreeConfigChange; 71 stackTraceTreeConfigElement.onTreeConfigChange = onTreeConfigChange;
72 stackTraceTreeConfigElement.show = false; 72 stackTraceTreeConfigElement.show = false;
73 stackTraceTreeConfigElement.showFilter = false;
73 cpuProfileTreeElement = shadowRoot.querySelector('#cpuProfileTree'); 74 cpuProfileTreeElement = shadowRoot.querySelector('#cpuProfileTree');
74 assert(cpuProfileTreeElement != null); 75 assert(cpuProfileTreeElement != null);
75 cpuProfileTreeElement.profile = sampleBufferControlElement.profile; 76 cpuProfileTreeElement.profile = sampleBufferControlElement.profile;
76 cpuProfileTreeElement.show = false; 77 cpuProfileTreeElement.show = false;
77 cls.fields.forEach((field) => field.reload()); 78 cls.fields.forEach((field) => field.reload());
78 sampleBufferControlElement.allocationProfileClass = cls; 79 sampleBufferControlElement.allocationProfileClass = cls;
79 } 80 }
80 81
81 Future refresh() { 82 Future refresh() {
82 instances = null; 83 instances = null;
83 retainedBytes = null; 84 retainedBytes = null;
84 mostRetained = null; 85 mostRetained = null;
85 var loads = []; 86 var loads = [];
86 loads.add(cls.reload()); 87 loads.add(cls.reload());
87 cls.fields.forEach((field) => loads.add(field.reload())); 88 cls.fields.forEach((field) => loads.add(field.reload()));
88 return Future.wait(loads); 89 return Future.wait(loads);
89 } 90 }
90 91
91 onSampleBufferChange(CpuProfile sampleBuffer) { 92 onSampleBufferChange(CpuProfile sampleBuffer) {
92 stackTraceTreeConfigElement.show = sampleBuffer.sampleCount > 0; 93 stackTraceTreeConfigElement.show = sampleBuffer.sampleCount > 0;
93 cpuProfileTreeElement.show = sampleBuffer.sampleCount > 0; 94 cpuProfileTreeElement.show = sampleBuffer.sampleCount > 0;
94 cpuProfileTreeElement.render(); 95 cpuProfileTreeElement.render();
95 } 96 }
96 97
97 onTreeConfigChange(String modeSelector, String directionSelector) { 98 onTreeConfigChange(String modeSelector,
99 String directionSelector,
100 String filter) {
98 ProfileTreeDirection direction = ProfileTreeDirection.Exclusive; 101 ProfileTreeDirection direction = ProfileTreeDirection.Exclusive;
99 if (directionSelector != 'Up') { 102 if (directionSelector != 'Up') {
100 direction = ProfileTreeDirection.Inclusive; 103 direction = ProfileTreeDirection.Inclusive;
101 } 104 }
102 ProfileTreeMode mode = ProfileTreeMode.Function; 105 ProfileTreeMode mode = ProfileTreeMode.Function;
103 if (modeSelector == 'Code') { 106 if (modeSelector == 'Code') {
104 mode = ProfileTreeMode.Code; 107 mode = ProfileTreeMode.Code;
105 } 108 }
106 cpuProfileTreeElement.direction = direction; 109 cpuProfileTreeElement.direction = direction;
107 cpuProfileTreeElement.mode = mode; 110 cpuProfileTreeElement.mode = mode;
108 cpuProfileTreeElement.render(); 111 cpuProfileTreeElement.render();
109 } 112 }
110 113
111 Future refreshAllocationProfile() async { 114 Future refreshAllocationProfile() async {
112 return sampleBufferControlElement.reload(cls.isolate); 115 return sampleBufferControlElement.reload(cls.isolate);
113 } 116 }
114 117
115 Future toggleAllocationTrace() { 118 Future toggleAllocationTrace() {
116 if (cls == null) { 119 if (cls == null) {
117 return new Future(refresh); 120 return new Future(refresh);
118 } 121 }
119 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh); 122 return cls.setTraceAllocations(!cls.traceAllocations).whenComplete(refresh);
120 } 123 }
121 } 124 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/app/view_model.dart ('k') | runtime/observatory/lib/src/elements/class_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698