diff options
author | Sergei Trofimov <sergei.trofimov@arm.com> | 2019-01-14 10:21:37 +0000 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2019-02-05 10:27:06 +0000 |
commit | 462a5b651a9360fcde34b26df51ded98699c1f38 (patch) | |
tree | cef0d743ed5ec9196c6015b7d2bb6f04ffe7fd49 | |
parent | 7cd7b73f589f7b26239c8bc635b45f0efe871a69 (diff) |
fw/output: add label property to Metric
Add a "label" property to Metric that combines its name with its
classifiers into a single string.
-rw-r--r-- | doc/source/api/output.rst | 5 | ||||
-rw-r--r-- | wa/framework/output.py | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/doc/source/api/output.rst b/doc/source/api/output.rst index 5aea51ec..34c8b1ff 100644 --- a/doc/source/api/output.rst +++ b/doc/source/api/output.rst @@ -497,6 +497,11 @@ A :class:`Metric` has the following attributes: or they may have been added by the workload to help distinguish between otherwise identical metrics. +``label`` + This is a string constructed from the name and classifiers, to provide a + more unique identifier, e.g. for grouping values across iterations. The + format is in the form ``name/cassifier1=value1/classifier2=value2/...``. + :class:`Artifact` ----------------- diff --git a/wa/framework/output.py b/wa/framework/output.py index 8ab10b67..3cf1f5ee 100644 --- a/wa/framework/output.py +++ b/wa/framework/output.py @@ -602,6 +602,12 @@ class Metric(Podable): instance._pod_version = pod_version # pylint: disable =protected-access return instance + @property + def label(self): + parts = ['{}={}'.format(n, v) for n, v in self.classifiers.items()] + parts.insert(0, self.name) + return '/'.join(parts) + def __init__(self, name, value, units=None, lower_is_better=False, classifiers=None): super(Metric, self).__init__() |