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

Unified Diff: tracing/tracing/value/histogram.html

Issue 2334233003: Merge NumericValue into Histogram (Closed)
Patch Set: fix rail_power_metric Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/value/diagnostics/related_value_set.html ('k') | tracing/tracing/value/histogram_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/value/histogram.html
diff --git a/tracing/tracing/value/histogram.html b/tracing/tracing/value/histogram.html
index af120f7355547b09e2536c5a8be1c7006a75cb71..ce55f0660f32eb8bbd264d0004d471b273a0062a 100644
--- a/tracing/tracing/value/histogram.html
+++ b/tracing/tracing/value/histogram.html
@@ -94,9 +94,8 @@ tr.exportTo('tr.v', function() {
* @param {!tr.b.Unit} unit
* @param {!tr.v.HistogramBinBoundaries=} opt_binBoundaries
*/
- class Histogram extends tr.v.NumericBase {
- constructor(unit, opt_binBoundaries) {
- super(unit);
+ class Histogram {
+ constructor(name, unit, opt_binBoundaries) {
var binBoundaries = opt_binBoundaries;
if (!binBoundaries) {
@@ -104,13 +103,23 @@ tr.exportTo('tr.v', function() {
binBoundaries = DEFAULT_BOUNDARIES_FOR_UNIT.get(baseUnit.unitName);
}
+ // If this Histogram is being deserialized, then its guid will be set by
+ // fromDict().
+ // If this Histogram is being computed by a metric, then its guid will be
+ // allocated the first time the guid is gotten by asDict().
+ this.guid_ = undefined;
+
this.allBins = [];
this.centralBins = [];
+ this.description = '';
+ this.diagnostics = new tr.v.d.DiagnosticMap();
this.maxCount_ = 0;
+ this.name_ = name;
this.nanDiagnosticMaps = [];
this.numNans = 0;
this.running = new tr.b.RunningStatistics();
this.sampleValues_ = [];
+ this.shortName = undefined;
this.summaryOptions = {
count: true,
sum: true,
@@ -122,6 +131,7 @@ tr.exportTo('tr.v', function() {
nans: false,
percentile: []
};
+ this.unit = unit;
this.underflowBin = new HistogramBin(tr.b.Range.fromExplicitRange(
-Number.MAX_VALUE, binBoundaries.minBinBoundary));
@@ -139,10 +149,33 @@ tr.exportTo('tr.v', function() {
this.maxNumSampleValues = this.allBins.length * 10;
}
+ get name() {
+ return this.name_;
+ }
+
+ get guid() {
+ if (this.guid_ === undefined)
+ this.guid_ = tr.b.GUID.allocateUUID4();
+
+ return this.guid_;
+ }
+
+ set guid(guid) {
+ if (this.guid_ !== undefined)
+ throw new Error('Cannot reset guid');
+
+ this.guid_ = guid;
+ }
+
static fromDict(d) {
var boundaries = HistogramBinBoundaries.createWithBoundaries(
d.binBoundaries);
- var n = new Histogram(tr.b.Unit.fromJSON(d.unit), boundaries);
+ var n = new Histogram(d.name, tr.b.Unit.fromJSON(d.unit), boundaries);
+ n.guid = d.guid;
+ n.shortName = d.shortName;
+ n.description = d.description;
+ n.diagnostics.addDicts(d.diagnostics);
+
n.underflowBin.fromDict(d.underflowBin);
for (var i = 0; i < d.centralBins.length; ++i)
n.centralBins[i].fromDict(d.centralBins[i]);
@@ -460,7 +493,11 @@ tr.exportTo('tr.v', function() {
asDict() {
return {
- type: 'numeric',
+ name: this.name,
+ guid: this.guid,
+ shortName: this.shortName,
+ description: this.description,
+ diagnostics: this.diagnostics.asDict(),
unit: this.unit.asJSON(),
binBoundaries: this.binBoundaries,
« no previous file with comments | « tracing/tracing/value/diagnostics/related_value_set.html ('k') | tracing/tracing/value/histogram_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698