telemetry.value.merge_values | index telemetry/value/merge_values.py

`# Copyright 2013 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.`

Modules
`` |  |
telemetry.value.failure | telemetry.value.skip |  |

Functions
`` |  | DefaultKeyFunc(value) `Keys values in a standard way for grouping in merging and summary. Merging and summarization can be parameterized by a function that groups values into equivalence classes. Any function that returns a comparable object can be used as a key_func, but merge_values and summary both use this function by default, to allow the default grouping to change as Telemtry does. Args: value: A Telemetry Value instance Returns: A comparable object used to group values.` GroupStably(all_values, key_func) `Groups an array by key_func, with the groups returned in a stable order. Returns a list of groups.` MergeLikeValuesFromDifferentPages(all_values, key_func=<function DefaultKeyFunc>) `Merges values that measure the same thing on different pages. After using MergeLikeValuesFromSamePage, one still ends up with values from different pages: ScalarValue(page1, 'x', 1, 'foo') ScalarValue(page1, 'y', 30, 'bar') ScalarValue(page2, 'x', 2, 'foo') ScalarValue(page2, 'y', 40, 'baz') This function will group values with the same name and tir_label together: ListOfScalarValues(None, 'x', [1, 2], 'foo') ListOfScalarValues(None, 'y', [30], 'bar') ListOfScalarValues(None, 'y', [40], 'baz') The workhorse of this code is Value.MergeLikeValuesFromDifferentPages. Not all values that go into this function will come out: not every value can be merged across pages. Values whose MergeLikeValuesFromDifferentPages returns None will be omitted from the results. This requires (but assumes) that the values passed in with the same name pass the Value.IsMergableWith test. If this is not obeyed, the results will be undefined.` MergeLikeValuesFromSamePage(all_values, key_func=<function DefaultKeyFunc>) `Merges values that measure the same thing on the same page. A page may end up being measured multiple times, meaning that we may end up with something like this: ScalarValue(page1, 'x', 1, 'foo') ScalarValue(page2, 'x', 4, 'bar') ScalarValue(page1, 'x', 2, 'foo') ScalarValue(page2, 'x', 5, 'baz') This function will produce: ListOfScalarValues(page1, 'x', [1, 2], 'foo') ListOfScalarValues(page2, 'x', [4], 'bar') ListOfScalarValues(page2, 'x', [5], 'baz') The workhorse of this code is Value.MergeLikeValuesFromSamePage. This requires (but assumes) that the values passed in with the same grouping key pass the Value.IsMergableWith test. If this is not obeyed, the results will be undefined.`