OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from telemetry import value as value_module |
| 6 |
| 7 |
| 8 class SummarizableValue(value_module.Value): |
| 9 def __init__(self, page, name, units, important, description, tir_label, |
| 10 improvement_direction): |
| 11 """A summarizable value result from a test.""" |
| 12 super(SummarizableValue, self).__init__( |
| 13 page, name, units, important, description, tir_label) |
| 14 # TODO(eakuefner): uncomment this assert after Telemetry clients are fixed. |
| 15 # Note: Telemetry unittests satisfy this assert. |
| 16 # assert improvement_direction_module.IsValid(improvement_direction) |
| 17 self._improvement_direction = improvement_direction |
| 18 |
| 19 @property |
| 20 def improvement_direction(self): |
| 21 return self._improvement_direction |
| 22 |
| 23 def AsDict(self): |
| 24 d = super(SummarizableValue, self).AsDict() |
| 25 d['improvement_direction'] = self.improvement_direction |
| 26 return d |
| 27 |
| 28 @staticmethod |
| 29 def GetJSONTypeName(): |
| 30 return 'summarizable' |
| 31 |
| 32 def AsDictWithoutBaseClassEntries(self): |
| 33 d = super(SummarizableValue, self).AsDictWithoutBaseClassEntries() |
| 34 del d['improvement_direction'] |
| 35 return d |
| 36 |
| 37 def GetBuildbotDataType(self, output_context): |
| 38 """Returns the buildbot's equivalent data_type. |
| 39 |
| 40 This should be one of the values accepted by perf_tests_results_helper.py. |
| 41 """ |
| 42 raise NotImplementedError() |
| 43 |
| 44 def GetBuildbotValue(self): |
| 45 """Returns the buildbot's equivalent value.""" |
| 46 raise NotImplementedError() |
| 47 |
| 48 @classmethod |
| 49 def MergeLikeValuesFromSamePage(cls, values): |
| 50 raise NotImplementedError() |
| 51 |
| 52 @classmethod |
| 53 def MergeLikeValuesFromDifferentPages(cls, values): |
| 54 raise NotImplementedError() |
| 55 |
| 56 def GetRepresentativeNumber(self): |
| 57 """Gets a single scalar value that best-represents this value. |
| 58 |
| 59 Returns None if not possible. |
| 60 """ |
| 61 raise NotImplementedError() |
| 62 |
| 63 def GetRepresentativeString(self): |
| 64 """Gets a string value that best-represents this value. |
| 65 |
| 66 Returns None if not possible. |
| 67 """ |
| 68 raise NotImplementedError() |
OLD | NEW |