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