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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory/isolate.dart

Issue 173013004: Add accumulator to allocation profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
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 part of observatory; 5 part of observatory;
6 6
7 7
8 /// State for a running isolate. 8 /// State for a running isolate.
9 class Isolate extends Observable { 9 class Isolate extends Observable {
10 static ObservatoryApplication _application; 10 static ObservatoryApplication _application;
11 11
12 @observable Profile profile; 12 @observable Profile profile;
13 @observable final Map<String, Script> scripts = 13 @observable final Map<String, Script> scripts =
14 toObservable(new Map<String, Script>()); 14 toObservable(new Map<String, Script>());
15 @observable final List<Code> codes = new List<Code>(); 15 @observable final List<Code> codes = new List<Code>();
16 @observable String id; 16 @observable String id;
17 @observable String name; 17 @observable String name;
18 @observable Map entry; 18 @observable Map entry;
19 @observable String rootLib; 19 @observable String rootLib;
20 @observable final Map<String, double> timers = 20 @observable final Map<String, double> timers =
21 toObservable(new Map<String, double>()); 21 toObservable(new Map<String, double>());
22 22
23 @observable int newHeapUsed = 0; 23 @observable int newHeapUsed = 0;
24 @observable int oldHeapUsed = 0; 24 @observable int oldHeapUsed = 0;
25 25
26 @observable Map topFrame = null; 26 @observable Map topFrame = null;
27 @observable String fileAndLine = null; 27 @observable String fileAndLine = null;
28 28
29 Isolate.fromId(this.id) : name = '' {} 29 Isolate.fromId(this.id) : name = '' {}
30 30
31 Isolate.fromMap(Map map) 31 Isolate.fromMap(Map map)
32 : id = map['id'], name = map['name'] { 32 : id = map['id'], name = map['name'] {
33 } 33 }
34 34
35 void refresh() { 35 void refresh() {
36 var request = '/$id/'; 36 var request = '/$id/';
37 _application.requestManager.requestMap(request).then((map) { 37 _application.requestManager.requestMap(request).then((map) {
38 update(map); 38 update(map);
39 }).catchError((e, trace) { 39 }).catchError((e, trace) {
40 Logger.root.severe('Error while updating isolate summary: $e\n$trace') ; 40 Logger.root.severe('Error while updating isolate summary: $e\n$trace') ;
41 }); 41 });
42 } 42 }
43 43
44 void update(Map map) { 44 void update(Map map) {
45 if (map['type'] != 'Isolate') { 45 if (map['type'] != 'Isolate') {
46 Logger.root.severe('Unexpected message type in Isolate.update: ${map["type "]}'); 46 Logger.root.severe('Unexpected message type in Isolate.update: ${map["type "]}');
47 return; 47 return;
48 } 48 }
49 if (map['name'] == null || 49 if (map['name'] == null ||
50 map['rootLib'] == null || 50 map['rootLib'] == null ||
51 map['timers'] == null || 51 map['timers'] == null ||
52 map['heap'] == null) { 52 map['heap'] == null) {
53 Logger.root.severe("Malformed 'Isolate' response: $map"); 53 Logger.root.severe("Malformed 'Isolate' response: $map");
(...skipping 27 matching lines...) Expand all
81 } 81 }
82 82
83 String toString() => '$id'; 83 String toString() => '$id';
84 84
85 Code findCodeByAddress(int address) { 85 Code findCodeByAddress(int address) {
86 for (var i = 0; i < codes.length; i++) { 86 for (var i = 0; i < codes.length; i++) {
87 if (codes[i].contains(address)) { 87 if (codes[i].contains(address)) {
88 return codes[i]; 88 return codes[i];
89 } 89 }
90 } 90 }
91 return null;
91 } 92 }
92 93
93 Code findCodeByName(String name) { 94 Code findCodeByName(String name) {
94 for (var i = 0; i < codes.length; i++) { 95 for (var i = 0; i < codes.length; i++) {
95 if (codes[i].name == name) { 96 if (codes[i].name == name) {
96 return codes[i]; 97 return codes[i];
97 } 98 }
98 } 99 }
100 return null;
99 } 101 }
100 102
101 void resetCodeTicks() { 103 void resetCodeTicks() {
102 Logger.root.info('Reset all code ticks.'); 104 Logger.root.info('Reset all code ticks.');
103 for (var i = 0; i < codes.length; i++) { 105 for (var i = 0; i < codes.length; i++) {
104 codes[i].resetTicks(); 106 codes[i].resetTicks();
105 } 107 }
106 } 108 }
107 109
108 void updateCoverage(List coverages) { 110 void updateCoverage(List coverages) {
109 for (var coverage in coverages) { 111 for (var coverage in coverages) {
110 var id = coverage['script']['id']; 112 var id = coverage['script']['id'];
111 var script = scripts[id]; 113 var script = scripts[id];
112 if (script == null) { 114 if (script == null) {
113 script = new Script.fromMap(coverage['script']); 115 script = new Script.fromMap(coverage['script']);
114 scripts[id] = script; 116 scripts[id] = script;
115 } 117 }
116 assert(script != null); 118 assert(script != null);
117 script._processCoverageHits(coverage['hits']); 119 script._processCoverageHits(coverage['hits']);
118 } 120 }
119 } 121 }
120 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698