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

Unified Diff: runtime/observatory/lib/src/allocation_profile/allocation_profile.dart

Issue 2255613002: Converted Observatory heap-profile element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Optimizations & Dead code removal 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
diff --git a/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart b/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f28900b9928eac36957185440c31adecd0d73ad6
--- /dev/null
+++ b/runtime/observatory/lib/src/allocation_profile/allocation_profile.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of allocation_profiler;
+
+class AllocationProfile implements M.AllocationProfile {
+ static const _lastServiceGC = 'dateLastServiceGC';
+ final DateTime lastServiceGC;
+ static const _lastAccumulatorReset = 'dateLastAccumulatorReset';
+ final DateTime lastAccumulatorReset;
+ final S.HeapSpace newSpace;
+ final S.HeapSpace oldSpace;
+ final Iterable<ClassHeapStats> members;
+
+ AllocationProfile(S.ServiceMap map)
+ : lastAccumulatorReset = _intString2DateTime(map[_lastAccumulatorReset]),
+ lastServiceGC = _intString2DateTime(map[_lastServiceGC]),
+ oldSpace = new S.HeapSpace()..update(map['heaps']['old']),
+ newSpace = new S.HeapSpace()..update(map['heaps']['new']),
+ members = map['members'].map(_convertMember).toList();
+
+ static DateTime _intString2DateTime(String milliseconds) =>
+ new DateTime.fromMillisecondsSinceEpoch(int.parse(milliseconds));
+
+ static ClassHeapStats _convertMember(S.ServiceMap map) {
+ assert(map['type'] == 'ClassHeapStats');
+ return new ClassHeapStats(map);
+ }
+}
+
+class ClassHeapStats implements M.ClassHeapStats {
+ final S.Class clazz;
+ final S.Allocations newSpace;
+ final S.Allocations oldSpace;
+ final int promotedInstances;
+ final int promotedBytes;
+
+ ClassHeapStats(S.ServiceMap map)
+ : clazz = map['class'],
+ oldSpace = new S.Allocations()..update(map['old']),
+ newSpace = new S.Allocations()..update(map['new']),
+ promotedInstances = map['promotedInstances'],
+ promotedBytes = map['promotedBytes'];
+}

Powered by Google App Engine
This is Rietveld 408576698