blob: b84f5d3ab826a3bd7c53345f4c349655a86125fb [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/base/base.html">
<script>
'use strict';
tr.exportTo('tr.b.units', function() {
/**
* Wrapper around a float that represents a power measurement in Watts.
*/
function PowerInWatts(numWatts) {
this.numWatts_ = numWatts;
};
PowerInWatts.prototype = {
toString: function() {
return PowerInWatts.format(this.numWatts_);
}
};
PowerInWatts.format = function(numWatts) {
return (numWatts * 1000.0)
.toLocaleString(undefined, { minimumFractionDigits: 3 }) + ' mW';
};
return {
PowerInWatts: PowerInWatts
};
});
</script>