Index: tracing/tracing/value/diagnostics/merged_telemetry_info.html |
diff --git a/tracing/tracing/value/diagnostics/merged_telemetry_info.html b/tracing/tracing/value/diagnostics/merged_telemetry_info.html |
deleted file mode 100644 |
index dfc3edd820e17e62c141c68ccd3ed9bfa263114b..0000000000000000000000000000000000000000 |
--- a/tracing/tracing/value/diagnostics/merged_telemetry_info.html |
+++ /dev/null |
@@ -1,302 +0,0 @@ |
-<!DOCTYPE html> |
-<!-- |
-Copyright 2017 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 MergedTelemetryInfo extends tr.v.d.Diagnostic { |
- constructor() { |
- super(); |
- this.benchmarkNames_ = new Set(); |
- this.benchmarkStartsMs_ = new Set(); |
- this.labels_ = new Set(); |
- this.legacyTIRLabels_ = new Set(); |
- this.storyDisplayNames_ = new Set(); |
- this.storyGroupingKeys_ = new Map(); |
- this.storysetRepeatCounters_ = new Set(); |
- } |
- |
- clone() { |
- const clone = new tr.v.d.MergedTelemetryInfo(); |
- clone.addDiagnostic(this); |
- return clone; |
- } |
- |
- addToHistogram(hist) { |
- hist.diagnostics.set(tr.v.d.RESERVED_NAMES.TELEMETRY, this); |
- } |
- |
- equals(other) { |
- if (!(other instanceof MergedTelemetryInfo)) return false; |
- if (!tr.b.setsEqual(this.benchmarkNames, other.benchmarkNames)) { |
- return false; |
- } |
- if (!tr.b.setsEqual(this.labels, other.labels)) return false; |
- if (!tr.b.setsEqual(this.storyDisplayNames, other.storyDisplayNames)) { |
- return false; |
- } |
- if (!tr.b.setsEqual(this.legacyTIRLabels, other.legacyTIRLabels)) { |
- return false; |
- } |
- if (!tr.b.setsEqual(this.storysetRepeatCounters, |
- other.storysetRepeatCounters)) { |
- return false; |
- } |
- if (!tr.b.setsEqual(this.benchmarkStartsMs, other.benchmarkStartsMs)) { |
- return false; |
- } |
- |
- if (!tr.b.setsEqual(new Set(this.storyGroupingKeys.keys()), |
- new Set(other.storyGroupingKeys.keys()))) { |
- return false; |
- } |
- for (const [k, vs] of this.storyGroupingKeys) { |
- if (!tr.b.setsEqual(vs, other.storyGroupingKeys.get(k))) { |
- return false; |
- } |
- } |
- |
- return true; |
- } |
- |
- canAddDiagnostic(otherDiagnostic) { |
- return otherDiagnostic instanceof MergedTelemetryInfo || |
- otherDiagnostic instanceof tr.v.d.TelemetryInfo; |
- } |
- |
- addDiagnostic(otherDiagnostic) { |
- if (otherDiagnostic instanceof MergedTelemetryInfo) { |
- for (const name of otherDiagnostic.benchmarkNames) { |
- this.benchmarkNames.add(name); |
- } |
- for (const t of otherDiagnostic.benchmarkStartsMs) { |
- this.benchmarkStartsMs.add(t); |
- } |
- for (const name of otherDiagnostic.labels) { |
- this.labels.add(name); |
- } |
- for (const name of otherDiagnostic.legacyTIRLabels) { |
- this.legacyTIRLabels.add(name); |
- } |
- for (const name of otherDiagnostic.storyDisplayNames) { |
- this.storyDisplayNames.add(name); |
- } |
- for (const name of otherDiagnostic.storysetRepeatCounters) { |
- this.storysetRepeatCounters.add(name); |
- } |
- for (const [name, value] of otherDiagnostic.storyGroupingKeys) { |
- if (this.storyGroupingKeys.has(name)) { |
- for (const subValue of value) { |
- this.storyGroupingKeys.get(name).add(subValue); |
- } |
- } else { |
- this.storyGroupingKeys.set(name, new Set(value)); |
- } |
- } |
- return; |
- } |
- |
- if (otherDiagnostic.benchmarkName) { |
- this.benchmarkNames.add(otherDiagnostic.benchmarkName); |
- } |
- if (otherDiagnostic.benchmarkStart !== undefined) { |
- // Store the number timestamps in the Set, not the Date objects. |
- // Sets uniquify based on object identity, not equivalency. |
- // Multiple different Date objects can have the same value, and we don't |
- // want to store multiple Dates with the same value. |
- // Dates are not interned like strings are. |
- // The |benchmarkStarts| getter converts the timestamps to Date objects. |
- this.benchmarkStartsMs.add(otherDiagnostic.benchmarkStart.getTime()); |
- } |
- if (otherDiagnostic.label) { |
- this.labels.add(otherDiagnostic.label); |
- } |
- if (otherDiagnostic.legacyTIRLabel) { |
- this.legacyTIRLabels.add(otherDiagnostic.legacyTIRLabel); |
- } |
- if (otherDiagnostic.storyDisplayName) { |
- this.storyDisplayNames.add(otherDiagnostic.storyDisplayName); |
- } |
- for (const [name, value] of otherDiagnostic.storyGroupingKeys) { |
- if (this.storyGroupingKeys.has(name)) { |
- this.storyGroupingKeys.get(name).add(value); |
- } else { |
- this.storyGroupingKeys.set(name, new Set([value])); |
- } |
- } |
- if (otherDiagnostic.storysetRepeatCounter !== undefined) { |
- this.storysetRepeatCounters.add(otherDiagnostic.storysetRepeatCounter); |
- } |
- } |
- |
- asDictInto_(d) { |
- if (this.benchmarkNames.size) { |
- d.benchmarkNames = Array.from(this.benchmarkNames); |
- } |
- if (this.benchmarkStartsMs.size) { |
- d.benchmarkStartsMs = Array.from(this.benchmarkStartsMs); |
- } |
- if (this.labels.size) { |
- d.labels = Array.from(this.labels); |
- } |
- if (this.legacyTIRLabels.size) { |
- d.legacyTIRLabels = this.legacyTIRLabels; |
- } |
- if (this.storyDisplayNames.size) { |
- d.storyDisplayNames = Array.from(this.storyDisplayNames); |
- } |
- if (this.storyGroupingKeys.size) { |
- d.storyGroupingKeys = {}; |
- for (const [name, values] of this.storyGroupingKeys) { |
- d.storyGroupingKeys[name] = Array.from(values); |
- } |
- } |
- if (this.storysetRepeatCounters.size) { |
- d.storysetRepeatCounters = Array.from(this.storysetRepeatCounters); |
- } |
- } |
- |
- static fromDict(d) { |
- const info = new MergedTelemetryInfo(); |
- for (const n of d.benchmarkNames || []) { |
- info.benchmarkNames_.add(n); |
- } |
- for (const n of d.benchmarkStartsMs || []) { |
- info.benchmarkStartsMs_.add(n); |
- } |
- for (const n of d.labels || []) { |
- info.labels_.add(n); |
- } |
- for (const n of d.legacyTIRLabels || []) { |
- info.legacyTIRLabels_.add(n); |
- } |
- for (const n of d.storyDisplayNames || []) { |
- info.storyDisplayNames_.add(n); |
- } |
- for (const [name, values] of Object.entries(d.storyGroupingKeys || {})) { |
- info.storyGroupingKeys_.set(name, new Set(values)); |
- } |
- for (const n of d.storysetRepeatCounters || []) { |
- info.storysetRepeatCounters_.add(n); |
- } |
- return info; |
- } |
- |
- get displayLabel() { |
- if (this.labels.size) { |
- return Array.from(this.labels).join('\n'); |
- } |
- return Array.from(this.benchmarkNames).concat( |
- this.benchmarkStartStrings).join('\n'); |
- } |
- |
- get benchmarkNames() { |
- return this.benchmarkNames_; |
- } |
- |
- get labels() { |
- return this.labels_; |
- } |
- |
- get legacyTIRLabels() { |
- return this.legacyTIRLabels_; |
- } |
- |
- get storyGroupingKeys() { |
- return this.storyGroupingKeys_; |
- } |
- |
- get storyDisplayNames() { |
- return this.storyDisplayNames_; |
- } |
- |
- get storysetRepeatCounters() { |
- return this.storysetRepeatCounters_; |
- } |
- |
- get storysetRepeatCounterLabel() { |
- return 'storyset repeat ' + Array.from( |
- this.storysetRepeatCounters).join(','); |
- } |
- |
- /** |
- * @return {!Set.<number>} |
- */ |
- get benchmarkStartsMs() { |
- return this.benchmarkStartsMs_; |
- } |
- |
- /** |
- * @return {!Array.<!Date>} |
- */ |
- get benchmarkStarts() { |
- const startsMs = Array.from(this.benchmarkStartsMs); |
- startsMs.sort((x, y) => x - y); |
- return startsMs.map(t => new Date(t)); |
- } |
- |
- /** |
- * @return {!Array.<string>} |
- */ |
- get benchmarkStartStrings() { |
- return this.benchmarkStarts.map(tr.b.formatDate); |
- } |
- |
- /** |
- * @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.MergedTelemetryInfo) || |
- !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.MergedTelemetryInfo)) { |
- return storyGroupingKey + ': undefined'; |
- } |
- return storyGroupingKey + ': ' + |
- telemetry.storyGroupingKeys[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 => MergedTelemetryInfo.getStoryGroupingKeyLabel( |
- v, storyGroupingKey); |
- } |
- } |
- |
- tr.v.d.Diagnostic.register(MergedTelemetryInfo, { |
- elementName: 'tr-v-ui-merged-telemetry-info-span' |
- }); |
- |
- return { |
- MergedTelemetryInfo, |
- }; |
-}); |
-</script> |