1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3 <html><head><title>Python: package telemetry.value</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>.value</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/__init__.py">telemetry/value/__init__.py</a></font></td></tr></table> 13 <p><tt>The <a href="#Value">Value</a> hierarchy provides a way of representing the values measurements<br> 14 produce such that they can be merged across runs, grouped by page, and output<br> 15 to different targets.<br> 16 <br> 17 The core <a href="#Value">Value</a> concept provides the basic functionality:<br> 18 - association with a page, may be none<br> 19 - naming and units<br> 20 - importance tracking [whether a value will show up on a waterfall or output<br> 21 file by default]<br> 22 - other metadata, such as a description of what was measured<br> 23 - default conversion to scalar and string<br> 24 - merging properties<br> 25 <br> 26 A page may actually run a few times during a single telemetry session.<br> 27 Downstream consumers of test results typically want to group these runs<br> 28 together, then compute summary statistics across runs. <a href="#Value">Value</a> provides the<br> 29 Merge* family of methods for this kind of aggregation.</tt></p> 30 <p> 31 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 32 <tr bgcolor="#aa55cc"> 33 <td colspan=3 valign=bottom> <br> 34 <font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr> 35 36 <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 37 <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.value.failure.html">failure</a><br> 38 <a href="telemetry.value.failure_unittest.html">failure_unittest</a><br> 39 <a href="telemetry.value.histogram.html">histogram</a><br> 40 <a href="telemetry.value.histogram_unittest.html">histogram_unittest</a><br> 41 <a href="telemetry.value.histogram_util.html">histogram_util</a><br> 42 <a href="telemetry.value.histogram_util_unittest.html">histogram_util_unittest</a><br> 43 <a href="telemetry.value.improvement_direction.html">improvement_direction</a><br> 44 </td><td width="25%" valign=top><a href="telemetry.value.list_of_scalar_values.html">list_of_scalar_values</a><br> 45 <a href="telemetry.value.list_of_scalar_values_unittest.html">list_of_scalar_values_unittest</a><br> 46 <a href="telemetry.value.list_of_string_values.html">list_of_string_values</a><br> 47 <a href="telemetry.value.list_of_string_values_unittest.html">list_of_string_values_unittest</a><br> 48 <a href="telemetry.value.merge_values.html">merge_values</a><br> 49 <a href="telemetry.value.merge_values_unittest.html">merge_values_unittest</a><br> 50 <a href="telemetry.value.none_values.html">none_values</a><br> 51 </td><td width="25%" valign=top><a href="telemetry.value.scalar.html">scalar</a><br> 52 <a href="telemetry.value.scalar_unittest.html">scalar_unittest</a><br> 53 <a href="telemetry.value.skip.html">skip</a><br> 54 <a href="telemetry.value.skip_unittest.html">skip_unittest</a><br> 55 <a href="telemetry.value.string.html">string</a><br> 56 <a href="telemetry.value.string_unittest.html">string_unittest</a><br> 57 <a href="telemetry.value.summarizable.html">summarizable</a><br> 58 </td><td width="25%" valign=top><a href="telemetry.value.summary.html">summary</a><br> 59 <a href="telemetry.value.summary_unittest.html">summary_unittest</a><br> 60 <a href="telemetry.value.trace.html">trace</a><br> 61 <a href="telemetry.value.trace_unittest.html">trace_unittest</a><br> 62 <a href="telemetry.value.value_unittest.html">value_unittest</a><br> 63 </td></tr></table></td></tr></table><p> 64 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 65 <tr bgcolor="#ee77aa"> 66 <td colspan=3 valign=bottom> <br> 67 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 68 69 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 70 <td width="100%"><dl> 71 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> 72 </font></dt><dd> 73 <dl> 74 <dt><font face="helvetica, arial"><a href="telemetry.value.html#Value">Value</a> 75 </font></dt></dl> 76 </dd> 77 </dl> 78 <p> 79 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 80 <tr bgcolor="#ffc8d8"> 81 <td colspan=3 valign=bottom> <br> 82 <font color="#000000" face="helvetica, arial"><a name="Value">class <strong>Value</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 83 84 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 85 <td colspan=2><tt>An abstract value produced by a telemetry page test.<br> </tt></td></tr> 86 <tr><td> </td> 87 <td width="100%">Methods defined here:<br> 88 <dl><dt><a name="Value-AsDict"><strong>AsDict</strong></a>(self)</dt><dd><tt>Pre-serializes a value to a dict for output as JSON.</tt></dd></dl> 89 90 <dl><dt><a name="Value-AsDictWithoutBaseClassEntries"><strong>AsDictWithoutBaseClassEntries</strong></a>(self)</dt></dl> 91 92 <dl><dt><a name="Value-GetBuildbotDataType"><strong>GetBuildbotDataType</strong></a>(self, output_context)</dt><dd><tt>Returns the buildbot's equivalent data_type.<br> 93 <br> 94 This should be one of the values accepted by perf_tests_results_helper.py.</tt></dd></dl> 95 96 <dl><dt><a name="Value-GetBuildbotValue"><strong>GetBuildbotValue</strong></a>(self)</dt><dd><tt>Returns the buildbot's equivalent value.</tt></dd></dl> 97 98 <dl><dt><a name="Value-GetChartAndTraceNameForComputedSummaryResult"><strong>GetChartAndTraceNameForComputedSummaryResult</strong></a>(self, trace_tag)</dt></dl> 99 100 <dl><dt><a name="Value-GetChartAndTraceNameForPerPageResult"><strong>GetChartAndTraceNameForPerPageResult</strong></a>(self)</dt></dl> 101 102 <dl><dt><a name="Value-GetRepresentativeNumber"><strong>GetRepresentativeNumber</strong></a>(self)</dt><dd><tt>Gets a single scalar value that best-represents this value.<br> 103 <br> 104 Returns None if not possible.</tt></dd></dl> 105 106 <dl><dt><a name="Value-GetRepresentativeString"><strong>GetRepresentativeString</strong></a>(self)</dt><dd><tt>Gets a string value that best-represents this value.<br> 107 <br> 108 Returns None if not possible.</tt></dd></dl> 109 110 <dl><dt><a name="Value-IsMergableWith"><strong>IsMergableWith</strong></a>(self, that)</dt></dl> 111 112 <dl><dt><a name="Value-__eq__"><strong>__eq__</strong></a>(self, other)</dt></dl> 113 114 <dl><dt><a name="Value-__hash__"><strong>__hash__</strong></a>(self)</dt></dl> 115 116 <dl><dt><a name="Value-__init__"><strong>__init__</strong></a>(self, page, name, units, important, description, tir_label)</dt><dd><tt>A generic <a href="#Value">Value</a> <a href="__builtin__.html#object">object</a>.<br> 117 <br> 118 Args:<br> 119 page: A Page <a href="__builtin__.html#object">object</a>, may be given as None to indicate that the value<br> 120 represents results for multiple pages.<br> 121 name: A value name string, may contain a dot. Values from the same test<br> 122 with the same prefix before the dot may be considered to belong to<br> 123 the same chart.<br> 124 units: A units string.<br> 125 important: Whether the value is "important". Causes the value to appear<br> 126 by default in downstream UIs.<br> 127 description: A string explaining in human-understandable terms what this<br> 128 value represents.<br> 129 tir_label: The string label of the TimelineInteractionRecord with<br> 130 which this value is associated.</tt></dd></dl> 131 132 <hr> 133 Class methods defined here:<br> 134 <dl><dt><a name="Value-MergeLikeValuesFromDifferentPages"><strong>MergeLikeValuesFromDifferentPages</strong></a>(cls, values)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Combines the provided values into a single compound value.<br> 135 <br> 136 When a full pageset runs, a single value_name will usually end up getting<br> 137 collected for multiple pages. For instance, we may end up with<br> 138 [ScalarValue(page1, 'a', 1),<br> 139 ScalarValue(page2, 'a', 2)]<br> 140 <br> 141 This function takes in the values of the same name, but across multiple<br> 142 pages, and produces a single summary result value. In this instance, it<br> 143 could produce a ScalarValue(None, 'a', 1.5) to indicate averaging, or even<br> 144 ListOfScalarValues(None, 'a', [1, 2]) if concatenated output was desired.<br> 145 <br> 146 Some results are so specific to a page that they make no sense when<br> 147 aggregated across pages. If merging values of this type across pages is<br> 148 non-sensical, this method may return None.</tt></dd></dl> 149 150 <dl><dt><a name="Value-MergeLikeValuesFromSamePage"><strong>MergeLikeValuesFromSamePage</strong></a>(cls, values)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Combines the provided list of values into a single compound value.<br> 151 <br> 152 When a page runs multiple times, it may produce multiple values. This<br> 153 function is given the same-named values across the multiple runs, and has<br> 154 the responsibility of producing a single result.<br> 155 <br> 156 It must return a single <a href="#Value">Value</a>. If merging does not make sense, the<br> 157 implementation must pick a representative value from one of the runs.<br> 158 <br> 159 For instance, it may be given<br> 160 [ScalarValue(page, 'a', 1), ScalarValue(page, 'a', 2)]<br> 161 and it might produce<br> 162 ListOfScalarValues(page, 'a', [1, 2])</tt></dd></dl> 163 164 <hr> 165 Static methods defined here:<br> 166 <dl><dt><a name="Value-FromDict"><strong>FromDict</strong></a>(value_dict, page_dict)</dt><dd><tt>Produces a value from a value dict and a page dict.<br> 167 <br> 168 <a href="#Value">Value</a> dicts are produced by serialization to JSON, and must be accompanied<br> 169 by a dict mapping page IDs to pages, also produced by serialization, in<br> 170 order to be completely deserialized. If deserializing multiple values, use<br> 171 ListOfValuesFromListOfDicts instead.<br> 172 <br> 173 value_dict: a dictionary produced by <a href="#Value-AsDict">AsDict</a>() on a value subclass.<br> 174 page_dict: a dictionary mapping IDs to page objects.</tt></dd></dl> 175 176 <dl><dt><a name="Value-GetConstructorKwArgs"><strong>GetConstructorKwArgs</strong></a>(value_dict, page_dict)</dt><dd><tt>Produces constructor arguments from a value dict and a page dict.<br> 177 <br> 178 Takes a dict parsed from JSON and an index of pages and recovers the<br> 179 keyword arguments to be passed to the constructor for deserializing the<br> 180 dict.<br> 181 <br> 182 value_dict: a dictionary produced by <a href="#Value-AsDict">AsDict</a>() on a value subclass.<br> 183 page_dict: a dictionary mapping IDs to page objects.</tt></dd></dl> 184 185 <dl><dt><a name="Value-GetJSONTypeName"><strong>GetJSONTypeName</strong></a>()</dt><dd><tt>Gets the typename for serialization to JSON using AsDict.</tt></dd></dl> 186 187 <dl><dt><a name="Value-ListOfValuesFromListOfDicts"><strong>ListOfValuesFromListOfDicts</strong></a>(value_dicts, page_dict)</dt><dd><tt>Takes a list of value dicts to values.<br> 188 <br> 189 Given a list of value dicts produced by AsDict, this method<br> 190 deserializes the dicts given a dict mapping page IDs to pages.<br> 191 This method performs memoization for deserializing a list of values<br> 192 efficiently, where FromDict is meant to handle one-offs.<br> 193 <br> 194 values: a list of value dicts produced by <a href="#Value-AsDict">AsDict</a>() on a value subclass.<br> 195 page_dict: a dictionary mapping IDs to page objects.</tt></dd></dl> 196 197 <hr> 198 Data descriptors defined here:<br> 199 <dl><dt><strong>__dict__</strong></dt> 200 <dd><tt>dictionary for instance variables (if defined)</tt></dd> 201 </dl> 202 <dl><dt><strong>__weakref__</strong></dt> 203 <dd><tt>list of weak references to the object (if defined)</tt></dd> 204 </dl> 205 <dl><dt><strong>name_suffix</strong></dt> 206 <dd><tt>Returns the string after a . in the name, or the full name otherwise.</tt></dd> 207 </dl> 208 </td></tr></table></td></tr></table><p> 209 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 210 <tr bgcolor="#eeaa77"> 211 <td colspan=3 valign=bottom> <br> 212 <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> 213 214 <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> 215 <td width="100%"><dl><dt><a name="-ValueNameFromTraceAndChartName"><strong>ValueNameFromTraceAndChartName</strong></a>(trace_name, chart_name<font color="#909090">=None</font>)</dt><dd><tt>Mangles a trace name plus optional chart name into a standard string.<br> 216 <br> 217 A value might just be a bareword name, e.g. numPixels. In that case, its<br> 218 chart may be None.<br> 219 <br> 220 But, a value might also be intended for display with other values, in which<br> 221 case the chart name indicates that grouping. So, you might have<br> 222 screen.numPixels, screen.resolution, where chartName='screen'.</tt></dd></dl> 223 </td></tr></table><p> 224 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 225 <tr bgcolor="#55aa55"> 226 <td colspan=3 valign=bottom> <br> 227 <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> 228 229 <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> 230 <td width="100%"><strong>COMPUTED_PER_PAGE_SUMMARY_OUTPUT_CONTEXT</strong> = 'merged-pages-result-output-context'<br> 231 <strong>CONCATENATE</strong> = 'concatenate'<br> 232 <strong>PER_PAGE_RESULT_OUTPUT_CONTEXT</strong> = 'per-page-result-output-context'<br> 233 <strong>PICK_FIRST</strong> = 'pick-first'<br> 234 <strong>SUMMARY_RESULT_OUTPUT_CONTEXT</strong> = 'summary-result-output-context'</td></tr></table> 235 </body></html>