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

Unified 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: Created dart objects for thread and zone and added threads field to isolate. 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/service/object.dart
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 58ef53fefb0b940567960e1500e12d68edc410b9..ad7accce420434792d88fd12ad4ca368c5db0e0e 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -4,6 +4,7 @@
part of service;
+
Cutch 2016/12/16 22:55:44 we usually don't add new whitespace
bkonyi 2016/12/16 22:59:57 This was accidental. Removed.
// Some value smaller than the object ring, so requesting a large array
// doesn't result in an expired ref because the elements lapped it in the
// object ring.
@@ -238,6 +239,9 @@ abstract class ServiceObject {
case 'SourceLocation':
obj = new SourceLocation._empty(owner);
break;
+ case '_Thread':
+ obj = new Thread._empty(owner);
+ break;
case 'UnresolvedSourceLocation':
obj = new UnresolvedSourceLocation._empty(owner);
break;
@@ -1501,6 +1505,9 @@ class Isolate extends ServiceObjectOwner implements M.Isolate {
List<ByteData> _chunksInProgress;
+ List<Thread> get threads => _threads;
+ List<Thread> _threads = new List<Thread>();
Cutch 2016/12/16 22:55:43 final List<Thread> _threads ...
bkonyi 2016/12/19 16:40:20 Done.
+
void _loadHeapSnapshot(ServiceEvent event) {
if (_snapshotFetch == null || _snapshotFetch.isClosed) {
// No outstanding snapshot request. Presumably another client asked for a
@@ -1624,6 +1631,11 @@ class Isolate extends ServiceObjectOwner implements M.Isolate {
if (map['extensionRPCs'] != null) {
extensionRPCs.addAll(map['extensionRPCs']);
}
+
+ List threadsList = map['threads'];
Cutch 2016/12/16 22:55:43 follow the pattern from above: threads.clear(); i
bkonyi 2016/12/19 16:40:20 Done.
+ threadsList.forEach((thread) {
+ threads.add(thread);
+ });
}
Future<TagProfile> updateTagProfile() {
@@ -3056,6 +3068,57 @@ class Sentinel extends ServiceObject implements M.Sentinel {
String get shortName => valueAsString;
}
+class Thread extends ServiceObject implements M.Thread {
+ M.ThreadKind get kind => _kind;
+ M.ThreadKind _kind;
+ List<Zone> get zones => _zones;
+ List<Zone> _zones = new List<Zone>();
Cutch 2016/12/16 22:55:44 final List<Zone> ...
bkonyi 2016/12/19 16:40:20 Done.
+
+ Thread._empty(ServiceObjectOwner owner) : super._empty(owner);
+
+ void _update(Map map, bool mapIsRef) {
+ String kindString = map['kind'];
+ List zoneList = map['zones'];
+
+ switch(kindString) {
Cutch 2016/12/16 22:55:44 is everything guaranteed to be sent even when this
bkonyi 2016/12/16 22:59:58 Currently Thread doesn't have a ref version. Shoul
+ case "kUnknownTask":
+ _kind = M.ThreadKind.kUnknownTask;
+ break;
+ case "kMutatorTask":
+ _kind = M.ThreadKind.kMutatorTask;
+ break;
+ case "kCompilerTask":
+ _kind = M.ThreadKind.kCompilerTask;
+ break;
+ case "kSweeperTask":
+ _kind = M.ThreadKind.kSweeperTask;
+ break;
+ case "kMarkerTask":
+ _kind = M.ThreadKind.kMarkerTask;
+ break;
+ case "kFinalizerTask":
+ _kind = M.ThreadKind.kFinalizerTask;
+ break;
+ default:
+ assert(false);
+ }
+ zoneList.forEach((zone) {
+ num capacity = zone['capacity'];
Cutch 2016/12/16 22:55:43 int here and elsewhere
bkonyi 2016/12/16 22:59:58 Right, done.
+ num used = zone['used'];
+ zones.add(new Zone(capacity, used));
+ });
+ }
+}
+
+class Zone implements M.Zone {
+ num get capacity => _capacity;
+ num _capacity;
+ num get used => _used;
+ num _used;
+
+ Zone(this._capacity, this._used);
+}
+
class Field extends HeapObject implements M.Field {
// Library or Class.
HeapObject dartOwner;

Powered by Google App Engine
This is Rietveld 408576698