summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-05-15 14:18:45 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-23 17:45:37 +0100
commit35c3e57686f6a29d9690c68dd43fc4d35dc1c43b (patch)
treedf28f4cf36dc4d49987c903c17cc8a4a1dcc82b1 /scripts
parentd6c437ff6c7c11947506058ee539691832ea4c45 (diff)
downloadpoky-35c3e57686f6a29d9690c68dd43fc4d35dc1c43b.tar.gz
scripts/buildstats-diff: support optimized rusage values
Buildstats from oe-build-perf-test results have been optimized to not have child rusage values at all. There, rusage is the sum of parent and child rusage values. This patch makes buildstats-diff compatible with this format. [YOCTO #11355] (From OE-Core rev: 496a9dc179fe9dc370c940f4a2f7bcab869a804f) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/buildstats-diff20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/buildstats-diff b/scripts/buildstats-diff
index adeba44988..4276464714 100755
--- a/scripts/buildstats-diff
+++ b/scripts/buildstats-diff
@@ -52,8 +52,12 @@ class BSTask(dict):
52 @property 52 @property
53 def cputime(self): 53 def cputime(self):
54 """Sum of user and system time taken by the task""" 54 """Sum of user and system time taken by the task"""
55 return self['rusage']['ru_stime'] + self['rusage']['ru_utime'] + \ 55 rusage = self['rusage']['ru_stime'] + self['rusage']['ru_utime']
56 self['child_rusage']['ru_stime'] + self['child_rusage']['ru_utime'] 56 if self['child_rusage']:
57 # Child rusage may have been optimized out
58 return rusage + self['child_rusage']['ru_stime'] + self['child_rusage']['ru_utime']
59 else:
60 return rusage
57 61
58 @property 62 @property
59 def walltime(self): 63 def walltime(self):
@@ -73,12 +77,20 @@ class BSTask(dict):
73 @property 77 @property
74 def read_ops(self): 78 def read_ops(self):
75 """Number of read operations on the block layer""" 79 """Number of read operations on the block layer"""
76 return self['rusage']['ru_inblock'] + self['child_rusage']['ru_inblock'] 80 if self['child_rusage']:
81 # Child rusage may have been optimized out
82 return self['rusage']['ru_inblock'] + self['child_rusage']['ru_inblock']
83 else:
84 return self['rusage']['ru_inblock']
77 85
78 @property 86 @property
79 def write_ops(self): 87 def write_ops(self):
80 """Number of write operations on the block layer""" 88 """Number of write operations on the block layer"""
81 return self['rusage']['ru_oublock'] + self['child_rusage']['ru_oublock'] 89 if self['child_rusage']:
90 # Child rusage may have been optimized out
91 return self['rusage']['ru_oublock'] + self['child_rusage']['ru_oublock']
92 else:
93 return self['rusage']['ru_oublock']
82 94
83 95
84def read_buildstats_file(buildstat_file): 96def read_buildstats_file(buildstat_file):