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

Side by Side Diff: tracing/tracing/value/ui/histogram_set_table_row.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/value/ui/histogram_set_table_cell.html"> 8 <link rel="import" href="/tracing/value/ui/histogram_set_table_cell.html">
9 <link rel="import" href="/tracing/value/ui/histogram_set_table_name_cell.html"> 9 <link rel="import" href="/tracing/value/ui/histogram_set_table_name_cell.html">
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 yield this; 147 yield this;
148 for (const row of this.subRows) yield* row.walk(); 148 for (const row of this.subRows) yield* row.walk();
149 } 149 }
150 150
151 static* walkAll(rootRows) { 151 static* walkAll(rootRows) {
152 for (const rootRow of rootRows) yield* rootRow.walk(); 152 for (const rootRow of rootRows) yield* rootRow.walk();
153 } 153 }
154 154
155 maybeRebin_() { 155 maybeRebin_() {
156 // if all of |this| row's columns are single-bin, then re-bin all of them. 156 // if all of |this| row's columns are single-bin, then re-bin all of them.
157 const dataRange = new tr.b.Range(); 157 const dataRange = new tr.b.math.Range();
158 for (const hist of this.columns.values()) { 158 for (const hist of this.columns.values()) {
159 if (!(hist instanceof tr.v.Histogram)) continue; 159 if (!(hist instanceof tr.v.Histogram)) continue;
160 if (hist.allBins.length > 1) return; // don't re-bin 160 if (hist.allBins.length > 1) return; // don't re-bin
161 if (hist.numValues === 0) continue; // ignore hist 161 if (hist.numValues === 0) continue; // ignore hist
162 dataRange.addValue(hist.min); 162 dataRange.addValue(hist.min);
163 dataRange.addValue(hist.max); 163 dataRange.addValue(hist.max);
164 } 164 }
165 165
166 dataRange.addValue(tr.b.lesserWholeNumber(dataRange.min)); 166 dataRange.addValue(tr.b.math.lesserWholeNumber(dataRange.min));
167 dataRange.addValue(tr.b.greaterWholeNumber(dataRange.max)); 167 dataRange.addValue(tr.b.math.greaterWholeNumber(dataRange.max));
168 168
169 if (dataRange.min === dataRange.max) return; // don't rebin 169 if (dataRange.min === dataRange.max) return; // don't rebin
170 170
171 const boundaries = tr.v.HistogramBinBoundaries.createLinear( 171 const boundaries = tr.v.HistogramBinBoundaries.createLinear(
172 dataRange.min, dataRange.max, tr.v.DEFAULT_REBINNED_COUNT); 172 dataRange.min, dataRange.max, tr.v.DEFAULT_REBINNED_COUNT);
173 173
174 for (const [name, hist] of this.columns) { 174 for (const [name, hist] of this.columns) {
175 if (!(hist instanceof tr.v.Histogram)) continue; 175 if (!(hist instanceof tr.v.Histogram)) continue;
176 this.columns.set(name, hist.rebin(boundaries)); 176 this.columns.set(name, hist.rebin(boundaries));
177 } 177 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 referenceDisplayLabel !== displayLabel) { 304 referenceDisplayLabel !== displayLabel) {
305 cell.referenceHistogram = this.columns.get( 305 cell.referenceHistogram = this.columns.get(
306 referenceDisplayLabel); 306 referenceDisplayLabel);
307 } 307 }
308 this.cells.set(displayLabel, cell); 308 this.cells.set(displayLabel, cell);
309 return cell; 309 return cell;
310 } 310 }
311 311
312 get overviewDataRange() { 312 get overviewDataRange() {
313 if (this.overviewDataRange_ === undefined) { 313 if (this.overviewDataRange_ === undefined) {
314 this.overviewDataRange_ = new tr.b.Range(); 314 this.overviewDataRange_ = new tr.b.math.Range();
315 for (let [displayLabel, hist] of this.columns) { 315 for (let [displayLabel, hist] of this.columns) {
316 if (hist.average !== undefined) { 316 if (hist.average !== undefined) {
317 this.overviewDataRange_.addValue(hist.average); 317 this.overviewDataRange_.addValue(hist.average);
318 } 318 }
319 319
320 for (let subRow of this.subRows) { 320 for (let subRow of this.subRows) {
321 let subHist = subRow.columns.get(displayLabel); 321 let subHist = subRow.columns.get(displayLabel);
322 if (!(subHist instanceof tr.v.Histogram)) continue; 322 if (!(subHist instanceof tr.v.Histogram)) continue;
323 if (subHist.average === undefined) continue; 323 if (subHist.average === undefined) continue;
324 this.overviewDataRange_.addValue(subHist.average); 324 this.overviewDataRange_.addValue(subHist.average);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 409 }
410 } 410 }
411 } 411 }
412 } 412 }
413 413
414 return { 414 return {
415 HistogramSetTableRow, 415 HistogramSetTableRow,
416 }; 416 };
417 }); 417 });
418 </script> 418 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/value/histogram_test.html ('k') | tracing/tracing/value/ui/histogram_set_table_row_state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698