[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1128/8267] oeqa.buildperf: add method for measuring file disk usage
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 1128/8267] oeqa.buildperf: add method for measuring file disk usage
- Date: Sat, 16 Dec 2017 21:23:37 +0000 (UTC)
commit 45c6a04a37b3dedb3eea7289c43978bddb8087c1
Author: Markus Lehtonen <markus lehtonen linux intel com>
Date: Wed May 11 13:53:22 2016 +0300
oeqa.buildperf: add method for measuring file disk usage
Add a new method to BuildPerfTest class for measuring the disk usage of
a file of directory.
(From OE-Core rev: 85cdc240e75d481e93238fbf75f8b8431da05f19)
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>
meta/lib/oeqa/buildperf/base.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 230a7e7..e29e9d1 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -75,6 +75,7 @@ def time_cmd(cmd, **kwargs):
class BuildPerfTest(object):
"""Base class for build performance tests"""
SYSRES = 'sysres'
+ DISKUSAGE = 'diskusage'
name = None
description = None
@@ -153,6 +154,24 @@ class BuildPerfTest(object):
with open(results_log, 'w') as fobj:
fobj.write(timedata)
+ def measure_disk_usage(self, path, name, legend):
+ """Estimate disk usage of a file or directory"""
+ # TODO: 'ignore_status' could/should be removed when globalres.log is
+ # deprecated. The function would just raise an exception, instead
+ ret = runCmd(['du', '-s', path], ignore_status=True)
+ if ret.status:
+ log.error("du failed, disk usage will be reported as 0")
+ size = 0
+ self._failed = True
+ else:
+ size = int(ret.output.split()[0])
+ log.debug("Size of %s path is %s", path, size)
+ measurement = {'type': self.DISKUSAGE,
+ 'name': name,
+ 'legend': legend}
+ measurement['values'] = {'size': size}
+ self.results['measurements'].append(measurement)
+
@staticmethod
def force_rm(path):
"""Equivalent of 'rm -rf'"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]