Bug 1287283 - Only add cpu_percent mozharness step to perfherder if defined r?gps
MozReview-Commit-ID: 3mGibyXY7cJ
--- a/testing/mozharness/mozharness/base/python.py
+++ b/testing/mozharness/mozharness/base/python.py
@@ -609,23 +609,27 @@ class ResourceMonitoringMixin(object):
})
for phase in rm.phases.keys():
phase_duration = rm.phases[phase][1] - rm.phases[phase][0]
subtests = [
{
'name': 'time',
'value': phase_duration,
- },
- {
+ }
+ ]
+ cpu_percent = rm.aggregate_cpu_percent(phase=phase,
+ per_cpu=False)
+ if cpu_percent is not None:
+ subtests.append({
'name': 'cpu_percent',
'value': rm.aggregate_cpu_percent(phase=phase,
per_cpu=False),
- }
- ]
+ })
+
# We don't report I/O during each step because measured I/O
# is system I/O and that I/O can be delayed (e.g. writes will
# buffer before being flushed and recorded in our metrics).
suites.append({
'name': '%s.%s' % (perfherder_name, phase),
'subtests': subtests,
})