Chromium Code Reviews| Index: runtime/bin/vmservice/client/lib/src/observatory/isolate.dart |
| =================================================================== |
| --- runtime/bin/vmservice/client/lib/src/observatory/isolate.dart (revision 32027) |
| +++ runtime/bin/vmservice/client/lib/src/observatory/isolate.dart (working copy) |
| @@ -4,19 +4,82 @@ |
| part of observatory; |
| + |
| /// State for a running isolate. |
| class Isolate extends Observable { |
| + static ObservatoryApplication _application; |
| + |
| @observable Profile profile; |
| @observable final Map<String, Script> scripts = |
| toObservable(new Map<String, Script>()); |
| @observable final List<Code> codes = new List<Code>(); |
| @observable String id; |
| @observable String name; |
| + @observable Map entry; |
| + @observable String rootLib; |
| + @observable final Map<String, double> timers = |
| + toObservable(new Map<String, double>()); |
| - Isolate(this.id, this.name); |
| + @observable int newHeapUsed = 0; |
| + @observable int oldHeapUsed = 0; |
| - String toString() => '$id $name'; |
| + @observable Map topFrame = null; |
| + @observable String fileAndLine = null; |
| + |
| + Isolate.fromId(this.id) : name = '$id' {} |
| + |
| + Isolate.fromMap(Map map) |
| + : id = map['id'], name = map['name'] { |
| + } |
| + void refresh() { |
| + var request = '/$id/'; |
| + _application.requestManager.requestMap(request).then((map) { |
| + update(map); |
| + }).catchError((e) { |
| + Logger.root.severe('Error while updating isolate summary: $e'); |
| + }); |
| + } |
| + |
| + void update(Map map) { |
| + if (map is! Map || map['type'] != 'Isolate') { |
| + return; |
| + } |
| + if (map['name'] != null) { |
| + name = map['name']; |
| + } |
| + if (map['rootLib'] != null) { |
| + rootLib = map['rootLib']['id']; |
| + } |
| + if (map['entry'] != null) { |
| + entry = map['entry']; |
| + } |
| + if (map['timers'] != null) { |
| + var timerMap = {}; |
| + map['timers'].forEach((timer) { |
| + timerMap[timer['name']] = timer['time']; |
| + }); |
| + print(timerMap); |
| + timers['total'] = timerMap['time_total_runtime']; |
| + timers['compile'] = timerMap['time_compilation']; |
| + timers['gc'] = 0.0; // TODO(turnidge): Export this from VM. |
| + timers['init'] = (timerMap['time_script_loading'] + |
| + timerMap['time_creating_snapshot'] + |
| + timerMap['time_isolate_initialization'] + |
| + timerMap['time_bootstrap']); |
| + timers['dart'] = timerMap['time_dart_execution']; |
| + } |
| + if (map['heap'] != null) { |
|
Cutch
2014/01/28 19:32:51
Can we assert on these being present in the respon
turnidge
2014/01/28 23:18:55
I changed the code to detect the malformed respons
|
| + newHeapUsed = map['heap']['usedNew']; |
| + oldHeapUsed = map['heap']['usedOld']; |
| + } |
| + if (map['topFrame'] != null) { |
| + topFrame = map['topFrame']; |
| + } |
| + } |
| + |
| + String toString() => '$id'; |
| + |
| Code findCodeByAddress(int address) { |
| for (var i = 0; i < codes.length; i++) { |
| if (codes[i].contains(address)) { |