blob: 247d707f58f7dd32d8c72d3df74032051a173d1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/tracing/ui/tracks/chart_track.html">
<link rel="import" href="/tracing/ui/tracks/container_track.html">
<link rel="import" href="/tracing/ui/tracks/memory_dump_track_util.html">
<script>
'use strict';
tr.exportTo('tr.ui.tracks', function() {
const ALLOCATED_MEMORY_TRACK_HEIGHT = 50;
/**
* A track that displays an array of ProcessMemoryDump objects.
* @constructor
* @extends {ContainerTrack}
*/
const ProcessMemoryDumpTrack = tr.ui.b.define(
'process-memory-dump-track', tr.ui.tracks.ContainerTrack);
ProcessMemoryDumpTrack.prototype = {
__proto__: tr.ui.tracks.ContainerTrack.prototype,
decorate(viewport) {
tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
this.memoryDumps_ = undefined;
},
get memoryDumps() {
return this.memoryDumps_;
},
set memoryDumps(memoryDumps) {
this.memoryDumps_ = memoryDumps;
this.updateContents_();
},
updateContents_() {
this.clearTracks_();
// Show no tracks if there are no dumps.
if (!this.memoryDumps_ || !this.memoryDumps_.length) return;
this.appendAllocatedMemoryTrack_();
},
appendAllocatedMemoryTrack_() {
const series = tr.ui.tracks.buildProcessAllocatedMemoryChartSeries(
this.memoryDumps_);
if (!series) return;
const track = new tr.ui.tracks.ChartTrack(this.viewport);
track.heading = 'Memory per component';
track.height = ALLOCATED_MEMORY_TRACK_HEIGHT + 'px';
track.series = series;
track.autoSetAllAxes({expandMax: true});
Polymer.dom(this).appendChild(track);
}
};
return {
ProcessMemoryDumpTrack,
};
});
</script>
|