OLD | NEW |
1 <!-- Copyright 2016 The Chromium Authors. All rights reserved. | 1 <!-- Copyright 2016 The Chromium Authors. All rights reserved. |
2 Use of this source code is governed by a BSD-style license that can be | 2 Use of this source code is governed by a BSD-style license that can be |
3 found in the LICENSE file. | 3 found in the LICENSE file. |
4 --> | 4 --> |
5 | 5 |
6 # How to Write Metrics | 6 # How to Write Metrics |
7 | 7 |
8 Timeline-Based Measurement v2 is a system for computing metrics from traces. | 8 Timeline-Based Measurement v2 is a system for computing metrics from traces. |
9 | 9 |
10 A TBM2 metric is a Javascript function that takes a trace Model and produces | 10 A TBM2 metric is a Javascript function that takes a trace Model and produces |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 * [RelatedHistogramBreakdown](/tracing/tracing/value/diagnostics/related_histog
ram_breakdown.html): | 163 * [RelatedHistogramBreakdown](/tracing/tracing/value/diagnostics/related_histog
ram_breakdown.html): |
164 Structurally, this is a RelatedHistogramMap, but conceptually and visually, t
his | 164 Structurally, this is a RelatedHistogramMap, but conceptually and visually, t
his |
165 is a Breakdown. Whereas Breakdown's stacked bar chart derives its data from | 165 is a Breakdown. Whereas Breakdown's stacked bar chart derives its data from |
166 the numbers contained explicitly in the Breakdown, a | 166 the numbers contained explicitly in the Breakdown, a |
167 RelatedHistogramBreakdown's stacked | 167 RelatedHistogramBreakdown's stacked |
168 bar chart derives its data from the referenced Histograms' sums. | 168 bar chart derives its data from the referenced Histograms' sums. |
169 | 169 |
170 ![](/docs/images/how-to-write-metrics-related-histogram-breakdown.png) | 170 ![](/docs/images/how-to-write-metrics-related-histogram-breakdown.png) |
171 | 171 |
172 ### Environment Information Diagnostics | |
173 | |
174 * [TelemetryInfo](/tracing/tracing/value/diagnostics/telemetry_info.html): | |
175 This is automatically attached to every Histogram produced by telemetry. | |
176 Structurally, it's a class with explicit named fields. | |
177 Conceptually, it contains information about the origins of the trace that was | |
178 consumed by the metric that produced the Histogram, such as the benchmark | |
179 name, story name, benchmark start timestamp, etc. | |
180 Visually, TelemetryInfos are displayed as a table. | |
181 | |
182 ![](/docs/images/how-to-write-metrics-telemetry.png) | |
183 | 172 |
184 ### Other Diagnostics | 173 ### Other Diagnostics |
185 | 174 |
186 * [Scalar](/tracing/tracing/value/diagnostics/scalar.html): | 175 * [Scalar](/tracing/tracing/value/diagnostics/scalar.html): |
187 Metrics must not use this, since it is incapable of being merged. It is | 176 Metrics must not use this, since it is incapable of being merged. It is |
188 mentioned here for completeness. It wraps a Scalar, which is just a | 177 mentioned here for completeness. It wraps a Scalar, which is just a |
189 unitted number. This is only to allow Histograms in other parts of the trace | 178 unitted number. This is only to allow Histograms in other parts of the trace |
190 viewer to display number sample diagnostics more intelligently than | 179 viewer to display number sample diagnostics more intelligently than |
191 GenericSet can. If a metric wants to display number sample diagnostics | 180 GenericSet can. If a metric wants to display number sample diagnostics |
192 intelligently, then it should use RelatedHistogramMap; if it does not want to | 181 intelligently, then it should use RelatedHistogramMap; if it does not want to |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 * `sum`: true | 271 * `sum`: true |
283 * `min`: true | 272 * `min`: true |
284 * `max`: true | 273 * `max`: true |
285 * `nans` (number of non-numeric samples): false | 274 * `nans` (number of non-numeric samples): false |
286 * `percentile`: [] | 275 * `percentile`: [] |
287 * Unlike the other options which are booleans, percentile is an array of | 276 * Unlike the other options which are booleans, percentile is an array of |
288 numbers between 0 and 1. In order to upload the median, for example, a | 277 numbers between 0 and 1. In order to upload the median, for example, a |
289 metric would call `histogram.customizeSummaryOptions({percentile: [0.5]})`. | 278 metric would call `histogram.customizeSummaryOptions({percentile: [0.5]})`. |
290 | 279 |
291 | 280 |
292 ## How histogram-set-table Uses Merging and TelemetryInfo | 281 ## How histogram-set-table Uses Merging |
293 | 282 |
294 The histogram-set-table element uses the fields of TelemetryInfo, along with the | 283 The histogram-set-table element uses the predefined |
295 merging capabilities of Histograms, to allow dynamic, hierarchical | 284 [HistogramGroupings](/tracing/tracing/value/histogram_set.html), along with the |
296 organization of histograms: | 285 merging capabilities of Histograms, to allow dynamic, hierarchical organization |
| 286 of histograms: |
297 | 287 |
298 * TelemetryInfo has mostly string/number (story name, story/set repeat count, | 288 * Predefined HistogramGroupings specify how to find the benchmark, story, etc. |
299 etc.) fields and one dict field that specifies the names of any story grouping | 289 that produced the Histogram. |
300 keys together with their histogram. | |
301 * After loading histograms, histogram-set-table computes categories to be | 290 * After loading histograms, histogram-set-table computes categories to be |
302 displayed by the groupby picker at the top of the UI: | 291 displayed by the groupby picker at the top of the UI: |
303 * Categories are fields of TelemetryInfo that have more than one value across | 292 * Categories are HistogramGroupings that have more than one value across |
304 all histograms in the HistogramSet. | 293 all histograms in the HistogramSet. |
305 * Instead of having one category for all story grouping keys, each grouping | 294 * Instead of having one category for all story grouping keys, each grouping |
306 individual grouping key may be listed as a category. For example, in Page | 295 individual grouping key may be listed as a category. For example, in Page |
307 Cycler v2 benchmarks, the "cache_temperature" grouping key would be | 296 Cycler v2 benchmarks, the "cache_temperature" grouping key would be |
308 displayed as a category. | 297 displayed as a category. |
309 * Choosing groups builds a hierarchy of histograms that is filled in by merging | 298 * Choosing groups builds a hierarchy of histograms that is filled in by merging |
310 histograms from the bottom up. Expanding the rows of histogram-set-table, any | 299 histograms from the bottom up. Expanding the rows of histogram-set-table, any |
311 leaf nodes are histograms that were loaded, and their ancestors are computed b
y | 300 leaf nodes are histograms that were loaded, and their ancestors are computed b
y |
312 merging. | 301 merging. |
313 * histogram-set-table uses the "label" property of TelemetryInfo to define the | 302 * histogram-set-table uses the "label" HistogramGrouping to define the columns |
314 columns of the table. | 303 of the table. |
OLD | NEW |