Bug 1287283 - Only add cpu_percent mozharness step to perfherder if defined r?gps draft
authorWilliam Lachance <wlachance@mozilla.com>
Tue, 19 Jul 2016 13:53:31 -0400
changeset 389655 5c5c0105b0c5b7aa47f9448a93128c7ebf8b8be3
parent 389550 5a91e5b49be3c1ba401b057e90c92d7488e3647d
child 389656 9c7c01884ed894a7ef5f6a460ec868fb298474a1
push id23477
push userwlachance@mozilla.com
push dateTue, 19 Jul 2016 19:17:03 +0000
reviewersgps
bugs1287283
milestone50.0a1
Bug 1287283 - Only add cpu_percent mozharness step to perfherder if defined r?gps MozReview-Commit-ID: 3mGibyXY7cJ
testing/mozharness/mozharness/base/python.py
--- 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,
                 })