diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-03-17 15:28:46 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-21 14:47:52 +0000 |
commit | f191ab0198e383cda37b0bfdfb6365d85499e36b (patch) | |
tree | ff96d3e1f23f12540e2af1bc5ed85614fd41f30e /bitbake | |
parent | 888683de7a25dc2f058b62bf4cad3c4b8e93d56e (diff) | |
download | poky-f191ab0198e383cda37b0bfdfb6365d85499e36b.tar.gz |
bitbake: toaster: measure task duration with server-side timestamps
The buildstats and toaster use separate time markers to measure the
duration of task execution. This causes a mismatch in the time
measured by buildstats class and the time measured in toaster.
The solution implemented here is to timestamp the creation of
every TaskBase event on the bitbake server side and calculate
the execution duration as the difference between creation time
of TaskSucceeded and TaskStarted events.
Based on an original patch by Marius Avram.
[YOCTO #5485]
(Bitbake rev: 7a08282c074c264f414cf7665dc873f51245072c)
Signed-off-by: Marius Avram <marius.avram@intel.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/build.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 52e41493c1..5cb4c06a88 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -30,6 +30,7 @@ import sys | |||
30 | import logging | 30 | import logging |
31 | import shlex | 31 | import shlex |
32 | import glob | 32 | import glob |
33 | import time | ||
33 | import bb | 34 | import bb |
34 | import bb.msg | 35 | import bb.msg |
35 | import bb.process | 36 | import bb.process |
@@ -75,6 +76,7 @@ class TaskBase(event.Event): | |||
75 | self.taskfile = d.getVar("FILE", True) | 76 | self.taskfile = d.getVar("FILE", True) |
76 | self.taskname = self._task | 77 | self.taskname = self._task |
77 | self.logfile = logfile | 78 | self.logfile = logfile |
79 | self.time = time.time() | ||
78 | event.Event.__init__(self) | 80 | event.Event.__init__(self) |
79 | self._message = "recipe %s: task %s: %s" % (d.getVar("PF", True), t, self.getDisplayName()) | 81 | self._message = "recipe %s: task %s: %s" % (d.getVar("PF", True), t, self.getDisplayName()) |
80 | 82 | ||
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 15bc069b8f..2084aab96c 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -133,10 +133,10 @@ class ORMWrapper(object): | |||
133 | elif outcome_task_setscene == Task.OUTCOME_FAILED: | 133 | elif outcome_task_setscene == Task.OUTCOME_FAILED: |
134 | task_object.sstate_result = Task.SSTATE_FAILED | 134 | task_object.sstate_result = Task.SSTATE_FAILED |
135 | 135 | ||
136 | # mark down duration if we have a start time | 136 | # mark down duration if we have a start time and a current time |
137 | if 'start_time' in task_information.keys(): | 137 | if 'start_time' in task_information.keys() and 'time' in vars(event): |
138 | duration = datetime.datetime.now() - task_information['start_time'] | 138 | duration = event.time - task_information['start_time'] |
139 | task_object.elapsed_time = duration.total_seconds() | 139 | task_object.elapsed_time = duration |
140 | 140 | ||
141 | task_object.save() | 141 | task_object.save() |
142 | return task_object | 142 | return task_object |
@@ -717,6 +717,9 @@ class BuildInfoHelper(object): | |||
717 | recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True) | 717 | recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True) |
718 | task_information = self._get_task_information(event,recipe) | 718 | task_information = self._get_task_information(event,recipe) |
719 | 719 | ||
720 | if 'time' in vars(event) and isinstance(event, bb.build.TaskStarted): | ||
721 | self.internal_state['taskdata'][identifier]['start_time'] = event.time | ||
722 | |||
720 | task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time'] | 723 | task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time'] |
721 | task_information['outcome'] = self.internal_state['taskdata'][identifier]['outcome'] | 724 | task_information['outcome'] = self.internal_state['taskdata'][identifier]['outcome'] |
722 | 725 | ||