1 2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3<html><head><title>Python: module telemetry.value.merge_values</title> 4<meta charset="utf-8"> 5</head><body bgcolor="#f0f0f8"> 6 7<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 8<tr bgcolor="#7799ee"> 9<td valign=bottom> <br> 10<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.value.html"><font color="#ffffff">value</font></a>.merge_values</strong></big></big></font></td 11><td align=right valign=bottom 12><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/value/merge_values.py">telemetry/value/merge_values.py</a></font></td></tr></table> 13 <p><tt># Copyright 2013 The Chromium Authors. All rights reserved.<br> 14# Use of this source code is governed by a BSD-style license that can be<br> 15# found in the LICENSE file.</tt></p> 16<p> 17<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 18<tr bgcolor="#aa55cc"> 19<td colspan=3 valign=bottom> <br> 20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 21 22<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 23<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.value.failure.html">telemetry.value.failure</a><br> 24</td><td width="25%" valign=top><a href="telemetry.value.skip.html">telemetry.value.skip</a><br> 25</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p> 26<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 27<tr bgcolor="#eeaa77"> 28<td colspan=3 valign=bottom> <br> 29<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> 30 31<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> 32<td width="100%"><dl><dt><a name="-DefaultKeyFunc"><strong>DefaultKeyFunc</strong></a>(value)</dt><dd><tt>Keys values in a standard way for grouping in merging and summary.<br> 33 <br> 34Merging and summarization can be parameterized by a function that groups<br> 35values into equivalence classes. Any function that returns a comparable<br> 36object can be used as a key_func, but merge_values and summary both use this<br> 37function by default, to allow the default grouping to change as Telemtry does.<br> 38 <br> 39Args:<br> 40 value: A Telemetry Value instance<br> 41 <br> 42Returns:<br> 43 A comparable object used to group values.</tt></dd></dl> 44 <dl><dt><a name="-GroupStably"><strong>GroupStably</strong></a>(all_values, key_func)</dt><dd><tt>Groups an array by key_func, with the groups returned in a stable order.<br> 45 <br> 46Returns a list of groups.</tt></dd></dl> 47 <dl><dt><a name="-MergeLikeValuesFromDifferentPages"><strong>MergeLikeValuesFromDifferentPages</strong></a>(all_values, key_func<font color="#909090">=<function DefaultKeyFunc></font>)</dt><dd><tt>Merges values that measure the same thing on different pages.<br> 48 <br> 49After using MergeLikeValuesFromSamePage, one still ends up with values from<br> 50different pages:<br> 51 ScalarValue(page1, 'x', 1, 'foo')<br> 52 ScalarValue(page1, 'y', 30, 'bar')<br> 53 ScalarValue(page2, 'x', 2, 'foo')<br> 54 ScalarValue(page2, 'y', 40, 'baz')<br> 55 <br> 56This function will group values with the same name and tir_label together:<br> 57 ListOfScalarValues(None, 'x', [1, 2], 'foo')<br> 58 ListOfScalarValues(None, 'y', [30], 'bar')<br> 59 ListOfScalarValues(None, 'y', [40], 'baz')<br> 60 <br> 61The workhorse of this code is Value.MergeLikeValuesFromDifferentPages.<br> 62 <br> 63Not all values that go into this function will come out: not every value can<br> 64be merged across pages. Values whose MergeLikeValuesFromDifferentPages returns<br> 65None will be omitted from the results.<br> 66 <br> 67This requires (but assumes) that the values passed in with the same name pass<br> 68the Value.IsMergableWith test. If this is not obeyed, the results<br> 69will be undefined.</tt></dd></dl> 70 <dl><dt><a name="-MergeLikeValuesFromSamePage"><strong>MergeLikeValuesFromSamePage</strong></a>(all_values, key_func<font color="#909090">=<function DefaultKeyFunc></font>)</dt><dd><tt>Merges values that measure the same thing on the same page.<br> 71 <br> 72A page may end up being measured multiple times, meaning that we may end up<br> 73with something like this:<br> 74 ScalarValue(page1, 'x', 1, 'foo')<br> 75 ScalarValue(page2, 'x', 4, 'bar')<br> 76 ScalarValue(page1, 'x', 2, 'foo')<br> 77 ScalarValue(page2, 'x', 5, 'baz')<br> 78 <br> 79This function will produce:<br> 80 ListOfScalarValues(page1, 'x', [1, 2], 'foo')<br> 81 ListOfScalarValues(page2, 'x', [4], 'bar')<br> 82 ListOfScalarValues(page2, 'x', [5], 'baz')<br> 83 <br> 84The workhorse of this code is Value.MergeLikeValuesFromSamePage.<br> 85 <br> 86This requires (but assumes) that the values passed in with the same grouping<br> 87key pass the Value.IsMergableWith test. If this is not obeyed, the<br> 88results will be undefined.</tt></dd></dl> 89</td></tr></table> 90</body></html>