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

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

Issue 3009553002: Refactor Histogram relationship diagnostics. (Closed)
Patch Set: Created 3 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/histogram.py ('k') | tracing/tracing/value/histogram_set.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/value/histogram_set.html
diff --git a/tracing/tracing/value/histogram_set.html b/tracing/tracing/value/histogram_set.html
index 84eabd8751d3da7ba1e80dbe30daf7c56af93651..2b3d6e13de8e695df7ebfd5f50617b242add27d1 100644
--- a/tracing/tracing/value/histogram_set.html
+++ b/tracing/tracing/value/histogram_set.html
@@ -6,7 +6,6 @@ found in the LICENSE file.
-->
<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/value/diagnostics/add_related_names.html">
<link rel="import" href="/tracing/value/histogram.html">
<link rel="import" href="/tracing/value/histogram_grouping.html">
@@ -150,35 +149,14 @@ tr.exportTo('tr.v', function() {
}
resolveRelatedHistograms() {
- const handleDiagnosticMap = dm => {
- for (const [name, diagnostic] of dm) {
- if (diagnostic instanceof tr.v.d.RelatedHistogramMap) {
- diagnostic.resolve(this);
- }
- }
- };
-
for (const hist of this) {
hist.diagnostics.resolveSharedDiagnostics(this);
-
- handleDiagnosticMap(hist.diagnostics);
-
- for (const dm of hist.nanDiagnosticMaps) {
- handleDiagnosticMap(dm);
- }
-
- for (const bin of hist.allBins) {
- for (const dm of bin.diagnosticMaps) {
- handleDiagnosticMap(dm);
- }
- }
}
}
/**
* Convert dicts to either Histograms or shared Diagnostics.
- * Does not resolve RelatedHistogramMap diagnostics. See
- * resolveRelatedHistograms().
+ * See resolveRelatedHistograms().
*
* @param {!Object} dicts
*/
@@ -212,37 +190,27 @@ tr.exportTo('tr.v', function() {
/**
* Find the Histograms that are not contained in any other Histograms'
- * RelatedHistogramMap diagnostics.
+ * RelatedNameMap diagnostics.
*
- * @return {!Array.<!tr.v.Histogram>}
+ * @return {!tr.v.HistogramSet}
*/
get sourceHistograms() {
- const sourceHistograms = new Map(this.histogramsByGuid_);
- // If a Histogram is in a RelatedHistogramMap,
- // which can be owned either by Histograms or by numeric samples, then it
- // is not a source Histogram.
- function deleteSourceHistograms(diagnosticMap) {
- for (const [name, diagnostic] of diagnosticMap) {
- if (diagnostic instanceof tr.v.d.RelatedHistogramMap) {
- for (const [name, relatedHist] of diagnostic) {
- sourceHistograms.delete(relatedHist.guid);
- }
+ const diagnosticNames = new Set();
+ for (const hist of this) {
+ for (const diagnostic of hist.diagnostics.values()) {
+ if (!(diagnostic instanceof tr.v.d.RelatedNameMap)) continue;
+ for (const name of diagnostic.values()) {
+ diagnosticNames.add(name);
}
}
}
-
+ const sourceHistograms = new HistogramSet();
for (const hist of this) {
- deleteSourceHistograms(hist.diagnostics);
- for (const dm of hist.nanDiagnosticMaps) {
- deleteSourceHistograms(dm);
- }
- for (const b of hist.allBins) {
- for (const dm of b.diagnosticMaps) {
- deleteSourceHistograms(dm);
- }
+ if (!diagnosticNames.has(hist.name)) {
+ sourceHistograms.addHistogram(hist);
}
}
- return new HistogramSet([...sourceHistograms.values()]);
+ return sourceHistograms;
}
/**
« no previous file with comments | « tracing/tracing/value/histogram.py ('k') | tracing/tracing/value/histogram_set.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698