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

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: 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
(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 if ((milliseconds == null) || milliseconds == '') {
25 return null;
26 }
27 return new DateTime.fromMillisecondsSinceEpoch(int.parse(milliseconds));
28 }
29
30 static ClassHeapStats _convertMember(S.ServiceMap map) {
31 assert(map['type'] == 'ClassHeapStats');
32 return new ClassHeapStats(map);
33 }
34 }
35
36 class ClassHeapStats implements M.ClassHeapStats {
37 final S.Class clazz;
38 final S.Allocations newSpace;
39 final S.Allocations oldSpace;
40 final int promotedInstances;
41 final int promotedBytes;
42
43 ClassHeapStats(S.ServiceMap map)
44 : clazz = map['class'],
45 oldSpace = new S.Allocations()..update(map['old']),
46 newSpace = new S.Allocations()..update(map['new']),
47 promotedInstances = map['promotedInstances'],
48 promotedBytes = map['promotedBytes'];
49 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/repositories.dart ('k') | runtime/observatory/lib/src/app/application.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698