blob: b06e9ec8bd9acd95c21761f0a4a20591c7f67a5d [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright 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/model/event_set.html">
<link rel="import" href="/tracing/ui/base/table.html">
<link rel="import" href="/tracing/value/ui/scalar_span.html">
<link rel="import" href="/tracing/value/unit.html">
<polymer-element name="tr-ui-a-power-sample-table">
<template>
<style>
:host {
display: flex;
}
</style>
<tr-ui-b-table id="table"></tr-ui-b-table>
</template>
</polymer-element>
<script>
'use strict';
var EventSet = tr.model.EventSet;
Polymer('tr-ui-a-power-sample-table', {
ready: function() {
this.$.table.tableColumns = [
{
title: 'Time',
width: '100px',
value: function(row) {
return tr.v.ui.createScalarSpan(row.start, {
unit: tr.v.Unit.byName.timeStampInMs
});
}
},
{
title: 'Power',
width: '100%',
value: function(row) {
return tr.v.ui.createScalarSpan(row.power / 1000, {
unit: tr.v.Unit.byName.powerInWatts
});
}
}
];
this.samples = new EventSet();
},
get samples() {
return this.samples_;
},
set samples(samples) {
this.samples_ = (samples === undefined) ? new EventSet() : samples;
this.updateContents_();
},
updateContents_: function() {
this.$.table.tableRows = this.samples.toArray();
this.$.table.rebuild();
}
});
</script>