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

Unified Diff: tracing/tracing/value/histogram_set_hierarchy.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_set.py ('k') | tracing/tracing/value/histogram_set_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/value/histogram_set_hierarchy.html
diff --git a/tracing/tracing/value/histogram_set_hierarchy.html b/tracing/tracing/value/histogram_set_hierarchy.html
index da23ef4f8708a2f38f15a13f852546ea34416ea0..7caf84934ceeff1bbb99651ff9eee9341b5bdc14 100644
--- a/tracing/tracing/value/histogram_set_hierarchy.html
+++ b/tracing/tracing/value/histogram_set_hierarchy.html
@@ -10,18 +10,6 @@ found in the LICENSE file.
<script>
'use strict';
tr.exportTo('tr.v', function() {
- function deleteMergedToDiagnostics(histogramArrayMap) {
- for (const [name, histograms] of histogramArrayMap) {
- if (histograms instanceof Array) {
- for (const histogram of histograms) {
- histogram.diagnostics.delete(tr.v.d.RESERVED_NAMES.MERGED_TO);
- }
- } else if (histograms instanceof Map) {
- deleteMergedToDiagnostics(histograms);
- }
- }
- }
-
/*
* See also HistogramSet.groupHistogramsRecursively().
* See also tr.v.ui.HistogramSetTableRow.
@@ -69,19 +57,6 @@ tr.exportTo('tr.v', function() {
histograms.deduplicateDiagnostics();
- for (const row of HistogramSetHierarchy.walkAll(rootRows)) {
- for (const [name, hist] of row.columns) {
- if (!(hist instanceof tr.v.Histogram)) continue;
- if (!row.mergeRelationshipsForColumn_.get(name)) continue;
- hist.diagnostics.mergeRelationships(hist);
- }
- }
-
- // Delete "mergedTo" diagnostics from the original Histograms, or else
- // they'll accumulate as the user re-groups them, and slow down future
- // mergeRelationships operations.
- deleteMergedToDiagnostics(histogramArrayMap);
-
for (const row of HistogramSetHierarchy.walkAll(rootRows)) {
row.maybeRebin_();
}
@@ -154,22 +129,6 @@ tr.exportTo('tr.v', function() {
continue;
}
- if (!existing.canAddHistogram(histogram)) {
- // Remember all of the original unmergeable Histograms so that
- // filter() can keep the rows that match the given HistogramSet even
- // if the rows will only be able to display (unmergeable).
- const unmergeableHistograms = new tr.v.HistogramSet([histogram]);
- const mergedFrom = existing.diagnostics.get(
- tr.v.d.RESERVED_NAMES.MERGED_FROM);
- if (mergedFrom !== undefined) {
- for (const [unusedName, origHist] of mergedFrom) {
- unmergeableHistograms.addHistogram(origHist);
- }
- }
- row.columns.set(columnName, unmergeableHistograms);
- continue;
- }
-
if (existing.name !== histogram.name) {
// It won't make sense to merge relationships for this merged
// Histogram.
@@ -211,64 +170,36 @@ tr.exportTo('tr.v', function() {
}
/**
- * Clones and filters |rows| to contain only |histograms|.
+ * Clones and filters |rows| to contain only |histogramNames|.
*
* @param {!Array.<HistogramSetHierarchy>} rows
- * @param {!tr.v.HistogramSet} histograms
+ * @param {!Set.<string>} histogramNames
* @returns {!Array.<HistogramSetHierarchy>}
*/
- static filter(rows, histograms) {
+ static filter(rows, histogramNames) {
const results = [];
for (const row of rows) {
let filteredSubRows = [];
if (row.subRows.length > 0) {
// This is a branch row. Drop it if all of its subrows were dropped.
filteredSubRows = HistogramSetHierarchy.filter(
- row.subRows, histograms);
+ row.subRows, histogramNames);
if (filteredSubRows.length === 0) continue;
} else {
// This is a leaf row. Drop it if none of the Histograms in
- // |row.columns| were merged from any in |histograms|.
+ // |row.columns| are named in |histogramNames|.
let found = false;
for (const testHist of row.columns.values()) {
- if (testHist instanceof tr.v.HistogramSet) {
- // Keep this unmergeable cell if it was merged from any of
- // |histograms|.
- for (const origHist of testHist) {
- if (histograms.lookupHistogram(origHist.guid) !== undefined) {
- found = true;
- break;
- }
- }
- if (found) break;
-
- continue;
- }
-
if (!(testHist instanceof tr.v.Histogram)) {
throw new Error(
'Cells can only contain Histogram or HistogramSet');
}
- if (histograms.lookupHistogram(testHist.guid) !== undefined) {
+ if (histogramNames.has(testHist.name)) {
found = true;
break;
}
-
- const mergedFrom = testHist.diagnostics.get(
- tr.v.d.RESERVED_NAMES.MERGED_FROM);
- if (mergedFrom !== undefined) {
- for (const [unusedName, origHist] of mergedFrom) {
- if (histograms.lookupHistogram(origHist.guid) !== undefined) {
- found = true;
- break;
- }
- }
- }
- if (found) break;
}
- // If none of the Histograms in |row| were merged from any of
- // |histograms|, then drop this row.
if (!found) continue;
}
« no previous file with comments | « tracing/tracing/value/histogram_set.py ('k') | tracing/tracing/value/histogram_set_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698