| OLD | NEW |
| 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 class HeapSpace extends Observable implements M.HeapSpace { | 1080 class HeapSpace extends Observable implements M.HeapSpace { |
| 1081 @observable int used = 0; | 1081 @observable int used = 0; |
| 1082 @observable int capacity = 0; | 1082 @observable int capacity = 0; |
| 1083 @observable int external = 0; | 1083 @observable int external = 0; |
| 1084 @observable int collections = 0; | 1084 @observable int collections = 0; |
| 1085 @observable double totalCollectionTimeInSeconds = 0.0; | 1085 @observable double totalCollectionTimeInSeconds = 0.0; |
| 1086 @observable double averageCollectionPeriodInMillis = 0.0; | 1086 @observable double averageCollectionPeriodInMillis = 0.0; |
| 1087 | 1087 |
| 1088 Duration get avgCollectionTime { |
| 1089 final mcs = totalCollectionTimeInSeconds * Duration.MICROSECONDS_PER_SECOND |
| 1090 / math.max(collections, 1); |
| 1091 return new Duration(microseconds: mcs.ceil()); |
| 1092 } |
| 1093 |
| 1094 Duration get totalCollectionTime { |
| 1095 final mcs = totalCollectionTimeInSeconds * Duration.MICROSECONDS_PER_SECOND; |
| 1096 return new Duration(microseconds: mcs.ceil()); |
| 1097 } |
| 1098 |
| 1099 Duration get avgCollectionPeriod { |
| 1100 final mcs = averageCollectionPeriodInMillis |
| 1101 * Duration.MICROSECONDS_PER_MILLISECOND; |
| 1102 return new Duration(microseconds: mcs.ceil()); |
| 1103 } |
| 1104 |
| 1088 void update(Map heapMap) { | 1105 void update(Map heapMap) { |
| 1089 used = heapMap['used']; | 1106 used = heapMap['used']; |
| 1090 capacity = heapMap['capacity']; | 1107 capacity = heapMap['capacity']; |
| 1091 external = heapMap['external']; | 1108 external = heapMap['external']; |
| 1092 collections = heapMap['collections']; | 1109 collections = heapMap['collections']; |
| 1093 totalCollectionTimeInSeconds = heapMap['time']; | 1110 totalCollectionTimeInSeconds = heapMap['time']; |
| 1094 averageCollectionPeriodInMillis = heapMap['avgCollectionPeriodMillis']; | 1111 averageCollectionPeriodInMillis = heapMap['avgCollectionPeriodMillis']; |
| 1095 } | 1112 } |
| 1096 } | 1113 } |
| 1097 | 1114 |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 Script get rootScript { | 2226 Script get rootScript { |
| 2210 for (Script script in scripts) { | 2227 for (Script script in scripts) { |
| 2211 if (script.uri == uri) return script; | 2228 if (script.uri == uri) return script; |
| 2212 } | 2229 } |
| 2213 return null; | 2230 return null; |
| 2214 } | 2231 } |
| 2215 | 2232 |
| 2216 String toString() => "Library($uri)"; | 2233 String toString() => "Library($uri)"; |
| 2217 } | 2234 } |
| 2218 | 2235 |
| 2219 class AllocationCount extends Observable { | 2236 class AllocationCount extends Observable implements M.AllocationCount { |
| 2220 @observable int instances = 0; | 2237 @observable int instances = 0; |
| 2221 @observable int bytes = 0; | 2238 @observable int bytes = 0; |
| 2222 | 2239 |
| 2223 void reset() { | 2240 void reset() { |
| 2224 instances = 0; | 2241 instances = 0; |
| 2225 bytes = 0; | 2242 bytes = 0; |
| 2226 } | 2243 } |
| 2227 | 2244 |
| 2228 bool get empty => (instances == 0) && (bytes == 0); | 2245 bool get empty => (instances == 0) && (bytes == 0); |
| 2229 } | 2246 } |
| 2230 | 2247 |
| 2231 class Allocations { | 2248 class Allocations implements M.Allocations{ |
| 2232 // Indexes into VM provided array. (see vm/class_table.h). | 2249 // Indexes into VM provided array. (see vm/class_table.h). |
| 2233 static const ALLOCATED_BEFORE_GC = 0; | 2250 static const ALLOCATED_BEFORE_GC = 0; |
| 2234 static const ALLOCATED_BEFORE_GC_SIZE = 1; | 2251 static const ALLOCATED_BEFORE_GC_SIZE = 1; |
| 2235 static const LIVE_AFTER_GC = 2; | 2252 static const LIVE_AFTER_GC = 2; |
| 2236 static const LIVE_AFTER_GC_SIZE = 3; | 2253 static const LIVE_AFTER_GC_SIZE = 3; |
| 2237 static const ALLOCATED_SINCE_GC = 4; | 2254 static const ALLOCATED_SINCE_GC = 4; |
| 2238 static const ALLOCATED_SINCE_GC_SIZE = 5; | 2255 static const ALLOCATED_SINCE_GC_SIZE = 5; |
| 2239 static const ACCUMULATED = 6; | 2256 static const ACCUMULATED = 6; |
| 2240 static const ACCUMULATED_SIZE = 7; | 2257 static const ACCUMULATED_SIZE = 7; |
| 2241 | 2258 |
| (...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4094 var v = list[i]; | 4111 var v = list[i]; |
| 4095 if ((v is ObservableMap) && _isServiceMap(v)) { | 4112 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 4096 list[i] = owner.getFromMap(v); | 4113 list[i] = owner.getFromMap(v); |
| 4097 } else if (v is ObservableList) { | 4114 } else if (v is ObservableList) { |
| 4098 _upgradeObservableList(v, owner); | 4115 _upgradeObservableList(v, owner); |
| 4099 } else if (v is ObservableMap) { | 4116 } else if (v is ObservableMap) { |
| 4100 _upgradeObservableMap(v, owner); | 4117 _upgradeObservableMap(v, owner); |
| 4101 } | 4118 } |
| 4102 } | 4119 } |
| 4103 } | 4120 } |
| OLD | NEW |