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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 2574643003: Added ability to request zone memory information for all isolates through the VM service and added … (Closed)
Patch Set: Addressed bugs found in last patch, converted additional variables to use strong types, updated com… Created 4 years 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) 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 part of service; 5 part of service;
6 6
7 // Some value smaller than the object ring, so requesting a large array 7 // Some value smaller than the object ring, so requesting a large array
8 // doesn't result in an expired ref because the elements lapped it in the 8 // doesn't result in an expired ref because the elements lapped it in the
9 // object ring. 9 // object ring.
10 const int kDefaultFieldLimit = 100; 10 const int kDefaultFieldLimit = 100;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 break; 231 break;
232 case 'Library': 232 case 'Library':
233 obj = new Library._empty(owner); 233 obj = new Library._empty(owner);
234 break; 234 break;
235 case 'Message': 235 case 'Message':
236 obj = new ServiceMessage._empty(owner); 236 obj = new ServiceMessage._empty(owner);
237 break; 237 break;
238 case 'SourceLocation': 238 case 'SourceLocation':
239 obj = new SourceLocation._empty(owner); 239 obj = new SourceLocation._empty(owner);
240 break; 240 break;
241 case '_Thread':
242 obj = new Thread._empty(owner);
243 break;
241 case 'UnresolvedSourceLocation': 244 case 'UnresolvedSourceLocation':
242 obj = new UnresolvedSourceLocation._empty(owner); 245 obj = new UnresolvedSourceLocation._empty(owner);
243 break; 246 break;
244 case 'Object': 247 case 'Object':
245 switch (vmType) { 248 switch (vmType) {
246 case 'ICData': 249 case 'ICData':
247 obj = new ICData._empty(owner); 250 obj = new ICData._empty(owner);
248 break; 251 break;
249 case 'LocalVarDescriptors': 252 case 'LocalVarDescriptors':
250 obj = new LocalVarDescriptors._empty(owner); 253 obj = new LocalVarDescriptors._empty(owner);
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 final HeapSpace newSpace = new HeapSpace(); 1497 final HeapSpace newSpace = new HeapSpace();
1495 final HeapSpace oldSpace = new HeapSpace(); 1498 final HeapSpace oldSpace = new HeapSpace();
1496 1499
1497 String fileAndLine; 1500 String fileAndLine;
1498 1501
1499 DartError error; 1502 DartError error;
1500 StreamController _snapshotFetch; 1503 StreamController _snapshotFetch;
1501 1504
1502 List<ByteData> _chunksInProgress; 1505 List<ByteData> _chunksInProgress;
1503 1506
1507 List<Thread> get threads => _threads;
1508 final List<Thread> _threads = new List<Thread>();
1509
1504 void _loadHeapSnapshot(ServiceEvent event) { 1510 void _loadHeapSnapshot(ServiceEvent event) {
1505 if (_snapshotFetch == null || _snapshotFetch.isClosed) { 1511 if (_snapshotFetch == null || _snapshotFetch.isClosed) {
1506 // No outstanding snapshot request. Presumably another client asked for a 1512 // No outstanding snapshot request. Presumably another client asked for a
1507 // snapshot. 1513 // snapshot.
1508 Logger.root.info("Dropping unsolicited heap snapshot chunk"); 1514 Logger.root.info("Dropping unsolicited heap snapshot chunk");
1509 return; 1515 return;
1510 } 1516 }
1511 1517
1512 // Occasionally these actually arrive out of order. 1518 // Occasionally these actually arrive out of order.
1513 var chunkIndex = event.chunkIndex; 1519 var chunkIndex = event.chunkIndex;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 libraries.addAll(map['libraries']); 1623 libraries.addAll(map['libraries']);
1618 libraries.sort(ServiceObject.LexicalSortName); 1624 libraries.sort(ServiceObject.LexicalSortName);
1619 if (savedStartTime == null) { 1625 if (savedStartTime == null) {
1620 vm._buildIsolateList(); 1626 vm._buildIsolateList();
1621 } 1627 }
1622 1628
1623 extensionRPCs.clear(); 1629 extensionRPCs.clear();
1624 if (map['extensionRPCs'] != null) { 1630 if (map['extensionRPCs'] != null) {
1625 extensionRPCs.addAll(map['extensionRPCs']); 1631 extensionRPCs.addAll(map['extensionRPCs']);
1626 } 1632 }
1633
1634 threads.clear();
1635 if(map['threads'] != null) {
1636 threads.addAll(map['threads']);
1637 }
1627 } 1638 }
1628 1639
1629 Future<TagProfile> updateTagProfile() { 1640 Future<TagProfile> updateTagProfile() {
1630 return isolate.invokeRpcNoUpgrade('_getTagProfile', {}).then((Map map) { 1641 return isolate.invokeRpcNoUpgrade('_getTagProfile', {}).then((Map map) {
1631 var seconds = new DateTime.now().millisecondsSinceEpoch / 1000.0; 1642 var seconds = new DateTime.now().millisecondsSinceEpoch / 1000.0;
1632 tagProfile._processTagProfile(seconds, map); 1643 tagProfile._processTagProfile(seconds, map);
1633 return tagProfile; 1644 return tagProfile;
1634 }); 1645 });
1635 } 1646 }
1636 1647
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 3060
3050 kind = stringToSentinelKind(map['kind']); 3061 kind = stringToSentinelKind(map['kind']);
3051 valueAsString = map['valueAsString']; 3062 valueAsString = map['valueAsString'];
3052 _loaded = true; 3063 _loaded = true;
3053 } 3064 }
3054 3065
3055 String toString() => 'Sentinel($kind)'; 3066 String toString() => 'Sentinel($kind)';
3056 String get shortName => valueAsString; 3067 String get shortName => valueAsString;
3057 } 3068 }
3058 3069
3070 class Thread extends ServiceObject implements M.Thread {
3071 M.ThreadKind get kind => _kind;
3072 M.ThreadKind _kind;
3073 List<Zone> get zones => _zones;
3074 final List<Zone> _zones = new List<Zone>();
3075
3076 Thread._empty(ServiceObjectOwner owner) : super._empty(owner);
3077
3078 void _update(Map map, bool mapIsRef) {
3079 String kindString = map['kind'];
3080 List<Map> zoneList = map['zones'];
3081
3082 switch(kindString) {
3083 case "kUnknownTask":
3084 _kind = M.ThreadKind.unknownTask;
3085 break;
3086 case "kMutatorTask":
3087 _kind = M.ThreadKind.mutatorTask;
3088 break;
3089 case "kCompilerTask":
3090 _kind = M.ThreadKind.compilerTask;
3091 break;
3092 case "kSweeperTask":
3093 _kind = M.ThreadKind.sweeperTask;
3094 break;
3095 case "kMarkerTask":
3096 _kind = M.ThreadKind.markerTask;
3097 break;
3098 case "kFinalizerTask":
3099 _kind = M.ThreadKind.finalizerTask;
3100 break;
3101 default:
3102 assert(false);
3103 }
3104 zones.clear();
3105 zoneList.forEach((zone) {
3106 int capacity = zone['capacity'];
3107 int used = zone['used'];
3108 zones.add(new Zone(capacity, used));
3109 });
3110 }
3111 }
3112
3113 class Zone implements M.Zone {
3114 int get capacity => _capacity;
3115 int _capacity;
3116 int get used => _used;
3117 int _used;
3118
3119 Zone(this._capacity, this._used);
3120 }
3121
3059 class Field extends HeapObject implements M.Field { 3122 class Field extends HeapObject implements M.Field {
3060 // Library or Class. 3123 // Library or Class.
3061 HeapObject dartOwner; 3124 HeapObject dartOwner;
3062 Library library; 3125 Library library;
3063 Instance declaredType; 3126 Instance declaredType;
3064 bool isStatic; 3127 bool isStatic;
3065 bool isFinal; 3128 bool isFinal;
3066 bool isConst; 3129 bool isConst;
3067 Instance staticValue; 3130 Instance staticValue;
3068 String name; 3131 String name;
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
4420 var v = list[i]; 4483 var v = list[i];
4421 if ((v is Map) && _isServiceMap(v)) { 4484 if ((v is Map) && _isServiceMap(v)) {
4422 list[i] = owner.getFromMap(v); 4485 list[i] = owner.getFromMap(v);
4423 } else if (v is List) { 4486 } else if (v is List) {
4424 _upgradeList(v, owner); 4487 _upgradeList(v, owner);
4425 } else if (v is Map) { 4488 } else if (v is Map) {
4426 _upgradeMap(v, owner); 4489 _upgradeMap(v, owner);
4427 } 4490 }
4428 } 4491 }
4429 } 4492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698