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

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

Issue 2255613002: Converted Observatory heap-profile element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Better sorting tests Created 4 years, 4 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 } 1082 }
1083 1083
1084 class HeapSpace extends Observable implements M.HeapSpace { 1084 class HeapSpace extends Observable implements M.HeapSpace {
1085 @observable int used = 0; 1085 @observable int used = 0;
1086 @observable int capacity = 0; 1086 @observable int capacity = 0;
1087 @observable int external = 0; 1087 @observable int external = 0;
1088 @observable int collections = 0; 1088 @observable int collections = 0;
1089 @observable double totalCollectionTimeInSeconds = 0.0; 1089 @observable double totalCollectionTimeInSeconds = 0.0;
1090 @observable double averageCollectionPeriodInMillis = 0.0; 1090 @observable double averageCollectionPeriodInMillis = 0.0;
1091 1091
1092 Duration get avgCollectionTime {
1093 final mcs = totalCollectionTimeInSeconds * Duration.MICROSECONDS_PER_SECOND
1094 / math.max(collections, 1);
1095 return new Duration(microseconds: mcs.ceil());
1096 }
1097
1098 Duration get totalCollectionTime {
1099 final mcs = totalCollectionTimeInSeconds * Duration.MICROSECONDS_PER_SECOND;
1100 return new Duration(microseconds: mcs.ceil());
1101 }
1102
1103 Duration get avgCollectionPeriod {
1104 final mcs = averageCollectionPeriodInMillis
1105 * Duration.MICROSECONDS_PER_MILLISECOND;
1106 return new Duration(microseconds: mcs.ceil());
1107 }
1108
1092 void update(Map heapMap) { 1109 void update(Map heapMap) {
1093 used = heapMap['used']; 1110 used = heapMap['used'];
1094 capacity = heapMap['capacity']; 1111 capacity = heapMap['capacity'];
1095 external = heapMap['external']; 1112 external = heapMap['external'];
1096 collections = heapMap['collections']; 1113 collections = heapMap['collections'];
1097 totalCollectionTimeInSeconds = heapMap['time']; 1114 totalCollectionTimeInSeconds = heapMap['time'];
1098 averageCollectionPeriodInMillis = heapMap['avgCollectionPeriodMillis']; 1115 averageCollectionPeriodInMillis = heapMap['avgCollectionPeriodMillis'];
1099 } 1116 }
1100 } 1117 }
1101 1118
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 Script get rootScript { 2236 Script get rootScript {
2220 for (Script script in scripts) { 2237 for (Script script in scripts) {
2221 if (script.uri == uri) return script; 2238 if (script.uri == uri) return script;
2222 } 2239 }
2223 return null; 2240 return null;
2224 } 2241 }
2225 2242
2226 String toString() => "Library($uri)"; 2243 String toString() => "Library($uri)";
2227 } 2244 }
2228 2245
2229 class AllocationCount extends Observable { 2246 class AllocationCount extends Observable implements M.AllocationCount {
2230 @observable int instances = 0; 2247 @observable int instances = 0;
2231 @observable int bytes = 0; 2248 @observable int bytes = 0;
2232 2249
2233 void reset() { 2250 void reset() {
2234 instances = 0; 2251 instances = 0;
2235 bytes = 0; 2252 bytes = 0;
2236 } 2253 }
2237 2254
2238 bool get empty => (instances == 0) && (bytes == 0); 2255 bool get empty => (instances == 0) && (bytes == 0);
2239 } 2256 }
2240 2257
2241 class Allocations { 2258 class Allocations implements M.Allocations{
2242 // Indexes into VM provided array. (see vm/class_table.h). 2259 // Indexes into VM provided array. (see vm/class_table.h).
2243 static const ALLOCATED_BEFORE_GC = 0; 2260 static const ALLOCATED_BEFORE_GC = 0;
2244 static const ALLOCATED_BEFORE_GC_SIZE = 1; 2261 static const ALLOCATED_BEFORE_GC_SIZE = 1;
2245 static const LIVE_AFTER_GC = 2; 2262 static const LIVE_AFTER_GC = 2;
2246 static const LIVE_AFTER_GC_SIZE = 3; 2263 static const LIVE_AFTER_GC_SIZE = 3;
2247 static const ALLOCATED_SINCE_GC = 4; 2264 static const ALLOCATED_SINCE_GC = 4;
2248 static const ALLOCATED_SINCE_GC_SIZE = 5; 2265 static const ALLOCATED_SINCE_GC_SIZE = 5;
2249 static const ACCUMULATED = 6; 2266 static const ACCUMULATED = 6;
2250 static const ACCUMULATED_SIZE = 7; 2267 static const ACCUMULATED_SIZE = 7;
2251 2268
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4259 var v = list[i]; 4276 var v = list[i];
4260 if ((v is ObservableMap) && _isServiceMap(v)) { 4277 if ((v is ObservableMap) && _isServiceMap(v)) {
4261 list[i] = owner.getFromMap(v); 4278 list[i] = owner.getFromMap(v);
4262 } else if (v is ObservableList) { 4279 } else if (v is ObservableList) {
4263 _upgradeObservableList(v, owner); 4280 _upgradeObservableList(v, owner);
4264 } else if (v is ObservableMap) { 4281 } else if (v is ObservableMap) {
4265 _upgradeObservableMap(v, owner); 4282 _upgradeObservableMap(v, owner);
4266 } 4283 }
4267 } 4284 }
4268 } 4285 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/repositories/allocation_profile.dart ('k') | runtime/observatory/lib/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698