summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/buildperf
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/buildperf')
-rw-r--r--meta/lib/oeqa/buildperf/base.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 230a7e7925..e29e9d1579 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -75,6 +75,7 @@ def time_cmd(cmd, **kwargs):
75class BuildPerfTest(object): 75class BuildPerfTest(object):
76 """Base class for build performance tests""" 76 """Base class for build performance tests"""
77 SYSRES = 'sysres' 77 SYSRES = 'sysres'
78 DISKUSAGE = 'diskusage'
78 79
79 name = None 80 name = None
80 description = None 81 description = None
@@ -153,6 +154,24 @@ class BuildPerfTest(object):
153 with open(results_log, 'w') as fobj: 154 with open(results_log, 'w') as fobj:
154 fobj.write(timedata) 155 fobj.write(timedata)
155 156
157 def measure_disk_usage(self, path, name, legend):
158 """Estimate disk usage of a file or directory"""
159 # TODO: 'ignore_status' could/should be removed when globalres.log is
160 # deprecated. The function would just raise an exception, instead
161 ret = runCmd(['du', '-s', path], ignore_status=True)
162 if ret.status:
163 log.error("du failed, disk usage will be reported as 0")
164 size = 0
165 self._failed = True
166 else:
167 size = int(ret.output.split()[0])
168 log.debug("Size of %s path is %s", path, size)
169 measurement = {'type': self.DISKUSAGE,
170 'name': name,
171 'legend': legend}
172 measurement['values'] = {'size': size}
173 self.results['measurements'].append(measurement)
174
156 @staticmethod 175 @staticmethod
157 def force_rm(path): 176 def force_rm(path):
158 """Equivalent of 'rm -rf'""" 177 """Equivalent of 'rm -rf'"""