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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 part of allocation_profiler;
6
7 class AllocationProfile implements M.AllocationProfile {
8 static const _lastServiceGC = 'dateLastServiceGC';
9 final DateTime lastServiceGC;
10 static const _lastAccumulatorReset = 'dateLastAccumulatorReset';
11 final DateTime lastAccumulatorReset;
12 final S.HeapSpace newSpace;
13 final S.HeapSpace oldSpace;
14 final Iterable<ClassHeapStats> members;
15
16 AllocationProfile(S.ServiceMap map)
17 : lastAccumulatorReset = _intString2DateTime(map[_lastAccumulatorReset]),
18 lastServiceGC = _intString2DateTime(map[_lastServiceGC]),
19 oldSpace = new S.HeapSpace()..update(map['heaps']['old']),
20 newSpace = new S.HeapSpace()..update(map['heaps']['new']),
21 members = map['members'].map(_convertMember).toList();
22
23 static DateTime _intString2DateTime(String milliseconds) =>
24 new DateTime.fromMillisecondsSinceEpoch(int.parse(milliseconds));
25
26 static ClassHeapStats _convertMember(S.ServiceMap map) {
27 assert(map['type'] == 'ClassHeapStats');
28 return new ClassHeapStats(map);
29 }
30 }
31
32 class ClassHeapStats implements M.ClassHeapStats {
33 final S.Class clazz;
34 final S.Allocations newSpace;
35 final S.Allocations oldSpace;
36 final int promotedInstances;
37 final int promotedBytes;
38
39 ClassHeapStats(S.ServiceMap map)
40 : clazz = map['class'],
41 oldSpace = new S.Allocations()..update(map['old']),
42 newSpace = new S.Allocations()..update(map['new']),
43 promotedInstances = map['promotedInstances'],
44 promotedBytes = map['promotedBytes'];
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698