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

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: Converted to using strong types, removed unused code and whitespace. 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 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 List threadsList = map['threads'];
Cutch 2016/12/19 14:46:09 please address all comments. From my previous revi
bkonyi 2016/12/19 16:40:20 Sorry, I had thought I had done this before. Done.
1635 threadsList.forEach((thread) {
1636 threads.add(thread);
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 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 zoneList = map['zones'];
Cutch 2016/12/19 14:46:09 use strong mode types here and elsewhere
bkonyi 2016/12/19 16:40:20 Done.
3081
3082 switch(kindString) {
3083 case "kUnknownTask":
3084 _kind = M.ThreadKind.kUnknownTask;
3085 break;
3086 case "kMutatorTask":
3087 _kind = M.ThreadKind.kMutatorTask;
3088 break;
3089 case "kCompilerTask":
3090 _kind = M.ThreadKind.kCompilerTask;
3091 break;
3092 case "kSweeperTask":
3093 _kind = M.ThreadKind.kSweeperTask;
3094 break;
3095 case "kMarkerTask":
3096 _kind = M.ThreadKind.kMarkerTask;
3097 break;
3098 case "kFinalizerTask":
3099 _kind = M.ThreadKind.kFinalizerTask;
3100 break;
3101 default:
3102 assert(false);
3103 }
3104 zoneList.forEach((zone) {
Cutch 2016/12/19 14:46:09 This will repeatedly add to the zone list. Follow
bkonyi 2016/12/19 16:40:20 Same as above. Done.
3105 int capacity = zone['capacity'];
3106 int used = zone['used'];
3107 zones.add(new Zone(capacity, used));
3108 });
3109 }
3110 }
3111
3112 class Zone implements M.Zone {
3113 num get capacity => _capacity;
3114 num _capacity;
3115 num get used => _used;
3116 num _used;
3117
3118 Zone(this._capacity, this._used);
3119 }
3120
3059 class Field extends HeapObject implements M.Field { 3121 class Field extends HeapObject implements M.Field {
3060 // Library or Class. 3122 // Library or Class.
3061 HeapObject dartOwner; 3123 HeapObject dartOwner;
3062 Library library; 3124 Library library;
3063 Instance declaredType; 3125 Instance declaredType;
3064 bool isStatic; 3126 bool isStatic;
3065 bool isFinal; 3127 bool isFinal;
3066 bool isConst; 3128 bool isConst;
3067 Instance staticValue; 3129 Instance staticValue;
3068 String name; 3130 String name;
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
4420 var v = list[i]; 4482 var v = list[i];
4421 if ((v is Map) && _isServiceMap(v)) { 4483 if ((v is Map) && _isServiceMap(v)) {
4422 list[i] = owner.getFromMap(v); 4484 list[i] = owner.getFromMap(v);
4423 } else if (v is List) { 4485 } else if (v is List) {
4424 _upgradeList(v, owner); 4486 _upgradeList(v, owner);
4425 } else if (v is Map) { 4487 } else if (v is Map) {
4426 _upgradeMap(v, owner); 4488 _upgradeMap(v, owner);
4427 } 4489 }
4428 } 4490 }
4429 } 4491 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698