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

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

Issue 2608463002: Added isolate + thread high watermark tracking to Observatory (Closed)
Patch Set: Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track o… Created 3 years, 11 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) 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 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 String fileAndLine; 1500 String fileAndLine;
1501 1501
1502 DartError error; 1502 DartError error;
1503 StreamController _snapshotFetch; 1503 StreamController _snapshotFetch;
1504 1504
1505 List<ByteData> _chunksInProgress; 1505 List<ByteData> _chunksInProgress;
1506 1506
1507 List<Thread> get threads => _threads; 1507 List<Thread> get threads => _threads;
1508 final List<Thread> _threads = new List<Thread>(); 1508 final List<Thread> _threads = new List<Thread>();
1509 1509
1510 int get memoryHighWatermark => _memoryHighWatermark;
1511 int _memoryHighWatermark;
1512
1510 void _loadHeapSnapshot(ServiceEvent event) { 1513 void _loadHeapSnapshot(ServiceEvent event) {
1511 if (_snapshotFetch == null || _snapshotFetch.isClosed) { 1514 if (_snapshotFetch == null || _snapshotFetch.isClosed) {
1512 // No outstanding snapshot request. Presumably another client asked for a 1515 // No outstanding snapshot request. Presumably another client asked for a
1513 // snapshot. 1516 // snapshot.
1514 Logger.root.info("Dropping unsolicited heap snapshot chunk"); 1517 Logger.root.info("Dropping unsolicited heap snapshot chunk");
1515 return; 1518 return;
1516 } 1519 }
1517 1520
1518 // Occasionally these actually arrive out of order. 1521 // Occasionally these actually arrive out of order.
1519 var chunkIndex = event.chunkIndex; 1522 var chunkIndex = event.chunkIndex;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 1631
1629 extensionRPCs.clear(); 1632 extensionRPCs.clear();
1630 if (map['extensionRPCs'] != null) { 1633 if (map['extensionRPCs'] != null) {
1631 extensionRPCs.addAll(map['extensionRPCs']); 1634 extensionRPCs.addAll(map['extensionRPCs']);
1632 } 1635 }
1633 1636
1634 threads.clear(); 1637 threads.clear();
1635 if(map['threads'] != null) { 1638 if(map['threads'] != null) {
1636 threads.addAll(map['threads']); 1639 threads.addAll(map['threads']);
1637 } 1640 }
1641
1642 _memoryHighWatermark = map['isolateMemoryHighWatermark'];
1638 } 1643 }
1639 1644
1640 Future<TagProfile> updateTagProfile() { 1645 Future<TagProfile> updateTagProfile() {
1641 return isolate.invokeRpcNoUpgrade('_getTagProfile', {}).then((Map map) { 1646 return isolate.invokeRpcNoUpgrade('_getTagProfile', {}).then((Map map) {
1642 var seconds = new DateTime.now().millisecondsSinceEpoch / 1000.0; 1647 var seconds = new DateTime.now().millisecondsSinceEpoch / 1000.0;
1643 tagProfile._processTagProfile(seconds, map); 1648 tagProfile._processTagProfile(seconds, map);
1644 return tagProfile; 1649 return tagProfile;
1645 }); 1650 });
1646 } 1651 }
1647 1652
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 3070
3066 String toString() => 'Sentinel($kind)'; 3071 String toString() => 'Sentinel($kind)';
3067 String get shortName => valueAsString; 3072 String get shortName => valueAsString;
3068 } 3073 }
3069 3074
3070 class Thread extends ServiceObject implements M.Thread { 3075 class Thread extends ServiceObject implements M.Thread {
3071 M.ThreadKind get kind => _kind; 3076 M.ThreadKind get kind => _kind;
3072 M.ThreadKind _kind; 3077 M.ThreadKind _kind;
3073 String get kindString => _kindString; 3078 String get kindString => _kindString;
3074 String _kindString; 3079 String _kindString;
3080 int get memoryHighWatermark => _memoryHighWatermark;
3081 int _memoryHighWatermark;
3075 List<Zone> get zones => _zones; 3082 List<Zone> get zones => _zones;
3076 final List<Zone> _zones = new List<Zone>(); 3083 final List<Zone> _zones = new List<Zone>();
3077 3084
3078 Thread._empty(ServiceObjectOwner owner) : super._empty(owner); 3085 Thread._empty(ServiceObjectOwner owner) : super._empty(owner);
3079 3086
3080 void _update(Map map, bool mapIsRef) { 3087 void _update(Map map, bool mapIsRef) {
3081 String rawKind = map['kind']; 3088 String rawKind = map['kind'];
3082 List<Map> zoneList = map['zones']; 3089 List<Map> zoneList = map['zones'];
3083 3090
3084 switch(rawKind) { 3091 switch(rawKind) {
(...skipping 17 matching lines...) Expand all
3102 _kind = M.ThreadKind.markerTask; 3109 _kind = M.ThreadKind.markerTask;
3103 _kindString = 'marker'; 3110 _kindString = 'marker';
3104 break; 3111 break;
3105 case "kFinalizerTask": 3112 case "kFinalizerTask":
3106 _kind = M.ThreadKind.finalizerTask; 3113 _kind = M.ThreadKind.finalizerTask;
3107 _kindString = 'finalizer'; 3114 _kindString = 'finalizer';
3108 break; 3115 break;
3109 default: 3116 default:
3110 assert(false); 3117 assert(false);
3111 } 3118 }
3119
3120 _memoryHighWatermark = map['threadMemoryHighWatermark'];
3121
3112 zones.clear(); 3122 zones.clear();
3113 zoneList.forEach((zone) { 3123 zoneList.forEach((zone) {
3114 int capacity = zone['capacity']; 3124 int capacity = zone['capacity'];
3115 int used = zone['used']; 3125 int used = zone['used'];
3116 zones.add(new Zone(capacity, used)); 3126 zones.add(new Zone(capacity, used));
3117 }); 3127 });
3118 } 3128 }
3119 } 3129 }
3120 3130
3121 class Zone implements M.Zone { 3131 class Zone implements M.Zone {
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
4491 var v = list[i]; 4501 var v = list[i];
4492 if ((v is Map) && _isServiceMap(v)) { 4502 if ((v is Map) && _isServiceMap(v)) {
4493 list[i] = owner.getFromMap(v); 4503 list[i] = owner.getFromMap(v);
4494 } else if (v is List) { 4504 } else if (v is List) {
4495 _upgradeList(v, owner); 4505 _upgradeList(v, owner);
4496 } else if (v is Map) { 4506 } else if (v is Map) {
4497 _upgradeMap(v, owner); 4507 _upgradeMap(v, owner);
4498 } 4508 }
4499 } 4509 }
4500 } 4510 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698