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:18:36 +0000 |
| commit | e5c3c1501bebe754cd3bd95539a2a798a28f59a3 (patch) | |
| tree | 6a1ed5ccb9907f7e0c44fadaed435520762e8311 | |
| parent | bb6990e05718d69e02df3433566a17a989fb0402 (diff) | |
| download | poky-e5c3c1501bebe754cd3bd95539a2a798a28f59a3.tar.gz | |
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)
(From OE-Core rev: 9c1bc0c2e49e1e98edb17bf0f00077497dd26272)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -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() { | |||
| 187 | def _read_stats(filename): | 187 | def _read_stats(filename): |
| 188 | cpu_usage = 0 | 188 | cpu_usage = 0 |
| 189 | disk_io = 0 | 189 | disk_io = 0 |
| 190 | startio = '' | 190 | startio = '0' |
| 191 | endio = '' | 191 | endio = '0' |
| 192 | started = '0' | ||
| 193 | ended = '0' | ||
| 192 | pn = '' | 194 | pn = '' |
| 193 | taskname = '' | 195 | taskname = '' |
| 194 | statinfo = {} | 196 | statinfo = {} |
| @@ -198,20 +200,28 @@ python toaster_collect_task_stats() { | |||
| 198 | k,v = line.strip().split(": ", 1) | 200 | k,v = line.strip().split(": ", 1) |
| 199 | statinfo[k] = v | 201 | statinfo[k] = v |
| 200 | 202 | ||
| 201 | try: | 203 | if "CPU usage" in statinfo: |
| 202 | cpu_usage = statinfo["CPU usage"] | 204 | cpu_usage = str(statinfo["CPU usage"]).strip('% \n\r') |
| 203 | endio = statinfo["EndTimeIO"] | ||
| 204 | startio = statinfo["StartTimeIO"] | ||
| 205 | except KeyError: | ||
| 206 | pass # we may have incomplete data here | ||
| 207 | 205 | ||
| 208 | if startio and endio: | 206 | if "EndTimeIO" in statinfo: |
| 209 | disk_io = int(endio.strip('\n ')) - int(startio.strip('\n ')) | 207 | endio = str(statinfo["EndTimeIO"]).strip('% \n\r') |
| 210 | 208 | ||
| 211 | if cpu_usage: | 209 | if "StartTimeIO" in statinfo: |
| 212 | cpu_usage = float(cpu_usage.strip('% \n')) | 210 | startio = str(statinfo["StartTimeIO"]).strip('% \n\r') |
| 213 | 211 | ||
| 214 | return {'cpu_usage': cpu_usage, 'disk_io': disk_io} | 212 | if "Started" in statinfo: |
| 213 | started = str(statinfo["Started"]).strip('% \n\r') | ||
| 214 | |||
| 215 | if "Ended" in statinfo: | ||
| 216 | ended = str(statinfo["Ended"]).strip('% \n\r') | ||
| 217 | |||
| 218 | disk_io = int(endio) - int(startio) | ||
| 219 | |||
| 220 | elapsed_time = float(ended) - float(started) | ||
| 221 | |||
| 222 | cpu_usage = float(cpu_usage) | ||
| 223 | |||
| 224 | return {'cpu_usage': cpu_usage, 'disk_io': disk_io, 'elapsed_time': elapsed_time} | ||
| 215 | 225 | ||
| 216 | 226 | ||
| 217 | if isinstance(e, (bb.build.TaskSucceeded, bb.build.TaskFailed)): | 227 | if isinstance(e, (bb.build.TaskSucceeded, bb.build.TaskFailed)): |
