Index: tracing/tracing/value/diagnostics/telemetry_info.html |
diff --git a/tracing/tracing/value/diagnostics/telemetry_info.html b/tracing/tracing/value/diagnostics/telemetry_info.html |
deleted file mode 100644 |
index f6371794f134dd7fce8168615e5808130693b02c..0000000000000000000000000000000000000000 |
--- a/tracing/tracing/value/diagnostics/telemetry_info.html |
+++ /dev/null |
@@ -1,212 +0,0 @@ |
-<!DOCTYPE html> |
-<!-- |
-Copyright 2016 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/utils.html"> |
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html"> |
- |
-<script> |
-'use strict'; |
- |
-tr.exportTo('tr.v.d', function() { |
- class TelemetryInfo extends tr.v.d.Diagnostic { |
- constructor(opt_info) { |
- super(); |
- |
- this.benchmarkName_ = ''; |
- this.benchmarkStart_ = undefined; |
- this.label_ = ''; |
- this.legacyTIRLabel_ = ''; |
- this.storyDisplayName_ = ''; |
- this.storyGroupingKeys_ = new Map(); |
- this.storysetRepeatCounter_ = undefined; |
- this.canonicalUrl_ = ''; |
- |
- if (opt_info) { |
- this.addInfo(opt_info); |
- } |
- } |
- |
- clone() { |
- const clone = new tr.v.d.MergedTelemetryInfo(); |
- clone.addDiagnostic(this); |
- return clone; |
- } |
- |
- /** |
- * @param {!Object} info |
- * @param {string} info.benchmarkName |
- * @param {undefined|string} info.label |
- * @param {undefined|!Object} info.storyGroupingKeys |
- * @param {undefined|string} info.storyDisplayName |
- * @param {number} info.storysetRepeatCounter |
- * @param {number} info.benchmarkStartMs Milliseconds since Unix epoch. |
- */ |
- addInfo(info) { |
- if (info.benchmarkName) { |
- this.benchmarkName_ = info.benchmarkName; |
- } |
- if (info.benchmarkStartMs !== undefined) { |
- this.benchmarkStart_ = new Date(info.benchmarkStartMs); |
- } |
- if (info.label) { |
- this.label_ = info.label; |
- } |
- if (info.storyDisplayName) { |
- this.storyDisplayName_ = info.storyDisplayName; |
- } |
- for (const [name, value] of Object.entries( |
- info.storyGroupingKeys || {})) { |
- this.storyGroupingKeys_.set(name, value); |
- } |
- if (info.storysetRepeatCounter !== undefined) { |
- this.storysetRepeatCounter_ = info.storysetRepeatCounter; |
- } |
- if (info.legacyTIRLabel) { |
- this.legacyTIRLabel_ = info.legacyTIRLabel; |
- } |
- if (info.canonicalUrl) { |
- this.canonicalUrl_ = info.canonicalUrl; |
- } |
- } |
- |
- addToHistogram(hist) { |
- hist.diagnostics.set(tr.v.d.RESERVED_NAMES.TELEMETRY, this); |
- } |
- |
- /** |
- * @param {!tr.v.Histogram} hist |
- * @return {(undefined|!tr.v.d.TelemetryInfo)} |
- */ |
- static getFromHistogram(hist) { |
- return hist.diagnostics.get(tr.v.d.RESERVED_NAMES.TELEMETRY) || |
- hist.diagnostics.get(tr.v.d.RESERVED_NAMES.ITERATION); |
- } |
- |
- asDictInto_(d) { |
- d.benchmarkName = this.benchmarkName; |
- if (this.benchmarkStart) { |
- d.benchmarkStartMs = this.benchmarkStart.getTime(); |
- } |
- d.label = this.label; |
- d.storyDisplayName = this.storyDisplayName; |
- if (this.storyGroupingKeys.size > 0) { |
- d.storyGroupingKeys = {}; |
- for (const [name, value] of this.storyGroupingKeys) { |
- d.storyGroupingKeys[name] = value; |
- } |
- } |
- d.storysetRepeatCounter = this.storysetRepeatCounter; |
- d.legacyTIRLabel = this.legacyTIRLabel; |
- d.canonicalUrl = this.canonicalUrl; |
- } |
- |
- static fromDict(d) { |
- const info = new TelemetryInfo(); |
- info.addInfo(d); |
- return info; |
- } |
- |
- get displayLabel() { |
- if (this.label) return this.label; |
- return this.benchmarkName + '\n' + this.benchmarkStartString; |
- } |
- |
- get benchmarkName() { |
- return this.benchmarkName_; |
- } |
- |
- get label() { |
- return this.label_; |
- } |
- |
- get legacyTIRLabel() { |
- return this.legacyTIRLabel_; |
- } |
- |
- set legacyTIRLabel(tir) { |
- this.legacyTIRLabel_ = tir; |
- } |
- |
- get storyGroupingKeys() { |
- return this.storyGroupingKeys_; |
- } |
- |
- get storyDisplayName() { |
- return this.storyDisplayName_; |
- } |
- |
- get storysetRepeatCounter() { |
- return this.storysetRepeatCounter_; |
- } |
- |
- get storysetRepeatCounterLabel() { |
- return 'storyset repeat ' + this.storysetRepeatCounter; |
- } |
- |
- get canonicalUrl() { |
- return this.canonicalUrl_; |
- } |
- |
- get benchmarkStart() { |
- return this.benchmarkStart_; |
- } |
- |
- get benchmarkStartString() { |
- if (this.benchmarkStart_ === undefined) return ''; |
- return tr.b.formatDate(this.benchmarkStart); |
- } |
- |
- /** |
- * @param {!tr.v.Histogram} hist |
- * @param {string} fieldName |
- * @param {*} defaultValue |
- * @return {*} |
- */ |
- static getField(hist, fieldName, defaultValue) { |
- const telemetry = tr.v.d.TelemetryInfo.getFromHistogram(hist); |
- if (!(telemetry instanceof tr.v.d.TelemetryInfo) || |
- !telemetry[fieldName]) { |
- return defaultValue; |
- } |
- return telemetry[fieldName]; |
- } |
- |
- /** |
- * @param {!tr.v.Histogram} hist |
- * @param {string} storyGroupingKey |
- * @return {string} |
- */ |
- static getStoryGroupingKeyLabel(hist, storyGroupingKey) { |
- const telemetry = tr.v.d.TelemetryInfo.getFromHistogram(hist); |
- if (!(telemetry instanceof tr.v.d.TelemetryInfo)) { |
- return storyGroupingKey + ': undefined'; |
- } |
- return storyGroupingKey + ': ' + |
- telemetry.storyGroupingKeys.get(storyGroupingKey); |
- } |
- |
- /** |
- * Returns a closure that gets a story grouping key label from a Histogram. |
- * |
- * @param {string} storyGroupingKey |
- * @return {!function(tr.v.Histogram):string} |
- */ |
- static makeStoryGroupingKeyLabelGetter(storyGroupingKey) { |
- return v => TelemetryInfo.getStoryGroupingKeyLabel( |
- v, storyGroupingKey); |
- } |
- } |
- |
- tr.v.d.Diagnostic.register(TelemetryInfo, { |
- elementName: 'tr-v-ui-telemetry-info-span' |
- }); |
- |
- return { |
- TelemetryInfo, |
- }; |
-}); |
-</script> |