[oe-commits] [openembedded-core] 66/102: oeqa.buildperf: measure io stat

git at git.openembedded.org git at git.openembedded.org
Tue Aug 30 22:58:36 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 9bc096952c91be1376d046bb2d69006cb75f1cef
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Mon Aug 29 22:48:27 2016 +0300

    oeqa.buildperf: measure io stat
    
    Add data from /proc/<pid>/io to system resource measurements.
    
    Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/buildperf/base.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 5987bfb..95a0abf 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -340,6 +340,11 @@ class BuildPerfTestCase(unittest.TestCase):
                 ret = runCmd2(cmd, **kwargs)
                 etime = datetime.now() - start_time
                 rusage_struct = resource.getrusage(resource.RUSAGE_CHILDREN)
+                iostat = {}
+                with open('/proc/{}/io'.format(os.getpid())) as fobj:
+                    for line in fobj.readlines():
+                        key, val = line.split(':')
+                        iostat[key] = int(val)
                 rusage = {}
                 # Skip unused fields, (i.e. 'ru_ixrss', 'ru_idrss', 'ru_isrss',
                 # 'ru_nswap', 'ru_msgsnd', 'ru_msgrcv' and 'ru_nsignals')
@@ -350,7 +355,8 @@ class BuildPerfTestCase(unittest.TestCase):
                 data_q.put({'ret': ret,
                             'start_time': start_time,
                             'elapsed_time': etime,
-                            'rusage': rusage})
+                            'rusage': rusage,
+                            'iostat': iostat})
             except Exception as err:
                 data_q.put(err)
 
@@ -378,7 +384,8 @@ class BuildPerfTestCase(unittest.TestCase):
                        'legend': legend}
         measurement['values'] = {'start_time': data['start_time'],
                                  'elapsed_time': etime,
-                                 'rusage': data['rusage']}
+                                 'rusage': data['rusage'],
+                                 'iostat': data['iostat']}
         self.measurements.append(measurement)
 
         # Append to 'times' array for globalres log

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list