| |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><title>Python: module telemetry.value.merge_values</title> |
| <meta charset="utf-8"> |
| </head><body bgcolor="#f0f0f8"> |
| |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| <tr bgcolor="#7799ee"> |
| <td valign=bottom> <br> |
| <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 |
| ><td align=right valign=bottom |
| ><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> |
| <p><tt># Copyright 2013 The Chromium Authors. All rights reserved.<br> |
| # Use of this source code is governed by a BSD-style license that can be<br> |
| # found in the LICENSE file.</tt></p> |
| <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#aa55cc"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
| <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> |
| </td><td width="25%" valign=top><a href="telemetry.value.skip.html">telemetry.value.skip</a><br> |
| </td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#eeaa77"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
| <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> |
| <br> |
| Merging and summarization can be parameterized by a function that groups<br> |
| values into equivalence classes. Any function that returns a comparable<br> |
| object can be used as a key_func, but merge_values and summary both use this<br> |
| function by default, to allow the default grouping to change as Telemtry does.<br> |
| <br> |
| Args:<br> |
| value: A Telemetry Value instance<br> |
| <br> |
| Returns:<br> |
| A comparable object used to group values.</tt></dd></dl> |
| <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> |
| <br> |
| Returns a list of groups.</tt></dd></dl> |
| <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> |
| <br> |
| After using MergeLikeValuesFromSamePage, one still ends up with values from<br> |
| different pages:<br> |
| ScalarValue(page1, 'x', 1, 'foo')<br> |
| ScalarValue(page1, 'y', 30, 'bar')<br> |
| ScalarValue(page2, 'x', 2, 'foo')<br> |
| ScalarValue(page2, 'y', 40, 'baz')<br> |
| <br> |
| This function will group values with the same name and tir_label together:<br> |
| ListOfScalarValues(None, 'x', [1, 2], 'foo')<br> |
| ListOfScalarValues(None, 'y', [30], 'bar')<br> |
| ListOfScalarValues(None, 'y', [40], 'baz')<br> |
| <br> |
| The workhorse of this code is Value.MergeLikeValuesFromDifferentPages.<br> |
| <br> |
| Not all values that go into this function will come out: not every value can<br> |
| be merged across pages. Values whose MergeLikeValuesFromDifferentPages returns<br> |
| None will be omitted from the results.<br> |
| <br> |
| This requires (but assumes) that the values passed in with the same name pass<br> |
| the Value.IsMergableWith test. If this is not obeyed, the results<br> |
| will be undefined.</tt></dd></dl> |
| <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> |
| <br> |
| A page may end up being measured multiple times, meaning that we may end up<br> |
| with something like this:<br> |
| ScalarValue(page1, 'x', 1, 'foo')<br> |
| ScalarValue(page2, 'x', 4, 'bar')<br> |
| ScalarValue(page1, 'x', 2, 'foo')<br> |
| ScalarValue(page2, 'x', 5, 'baz')<br> |
| <br> |
| This function will produce:<br> |
| ListOfScalarValues(page1, 'x', [1, 2], 'foo')<br> |
| ListOfScalarValues(page2, 'x', [4], 'bar')<br> |
| ListOfScalarValues(page2, 'x', [5], 'baz')<br> |
| <br> |
| The workhorse of this code is Value.MergeLikeValuesFromSamePage.<br> |
| <br> |
| This requires (but assumes) that the values passed in with the same grouping<br> |
| key pass the Value.IsMergableWith test. If this is not obeyed, the<br> |
| results will be undefined.</tt></dd></dl> |
| </td></tr></table> |
| </body></html> |