summaryrefslogtreecommitdiffstats
path: root/scripts/buildstats-diff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/buildstats-diff')
-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):