diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-10-31 19:15:48 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-31 10:17:14 +0000 |
commit | 9c1bc0c2e49e1e98edb17bf0f00077497dd26272 (patch) | |
tree | 6a7db65eef117607d694c58b5e04be284be6eb7a /meta | |
parent | 857661e7d55ac73c7c360f49a0103f2a5cd8a310 (diff) | |
download | openembedded-core-9c1bc0c2e49e1e98edb17bf0f00077497dd26272.tar.gz openembedded-core-9c1bc0c2e49e1e98edb17bf0f00077497dd26272.tar.bz2 openembedded-core-9c1bc0c2e49e1e98edb17bf0f00077497dd26272.zip |
toaster.bbclass: read elapsed time from the stats file
We read the elapsed time fromt the build stats file, instead
of computing it independently.
[YOCTO #6833]
[YOCTO #6685]
(From OE-Core rev: 4f5a4ec0cdaf078463f04be4a6683816e9b78d5f)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/toaster.bbclass | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass index 95499a5cdd..1525317d27 100644 --- a/meta/classes/toaster.bbclass +++ b/meta/classes/toaster.bbclass @@ -187,8 +187,10 @@ python toaster_collect_task_stats() { def _read_stats(filename): cpu_usage = 0 disk_io = 0 - startio = '' - endio = '' + startio = '0' + endio = '0' + started = '0' + ended = '0' pn = '' taskname = '' statinfo = {} @@ -198,20 +200,28 @@ python toaster_collect_task_stats() { k,v = line.strip().split(": ", 1) statinfo[k] = v - try: - cpu_usage = statinfo["CPU usage"] - endio = statinfo["EndTimeIO"] - startio = statinfo["StartTimeIO"] - except KeyError: - pass # we may have incomplete data here + if "CPU usage" in statinfo: + cpu_usage = str(statinfo["CPU usage"]).strip('% \n\r') - if startio and endio: - disk_io = int(endio.strip('\n ')) - int(startio.strip('\n ')) + if "EndTimeIO" in statinfo: + endio = str(statinfo["EndTimeIO"]).strip('% \n\r') - if cpu_usage: - cpu_usage = float(cpu_usage.strip('% \n')) + if "StartTimeIO" in statinfo: + startio = str(statinfo["StartTimeIO"]).strip('% \n\r') - return {'cpu_usage': cpu_usage, 'disk_io': disk_io} + if "Started" in statinfo: + started = str(statinfo["Started"]).strip('% \n\r') + + if "Ended" in statinfo: + ended = str(statinfo["Ended"]).strip('% \n\r') + + disk_io = int(endio) - int(startio) + + elapsed_time = float(ended) - float(started) + + cpu_usage = float(cpu_usage) + + return {'cpu_usage': cpu_usage, 'disk_io': disk_io, 'elapsed_time': elapsed_time} if isinstance(e, (bb.build.TaskSucceeded, bb.build.TaskFailed)): |