aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-03-18 14:58:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-21 14:47:42 +0000
commitfa9f4eb8784553deb782bff34c5e04012c2c52c9 (patch)
tree76d3a85df60a9613a48aedf35535b8c82df0b283 /lib
parent1ba9f310a8b4fd0952a95be86ab43ae27fe6d983 (diff)
downloadbitbake-fa9f4eb8784553deb782bff34c5e04012c2c52c9.tar.gz
toaster: fix task elapsed time calculation
This patch restricts the elapsed calculation to just the events that have the "time" parameter set. This fixes an error where data was lost due to an exception where invalid dictionary lookups were made on the wrong events. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/ui/buildinfohelper.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 2084aab96..08d9fcf8b 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -134,8 +134,8 @@ class ORMWrapper(object):
task_object.sstate_result = Task.SSTATE_FAILED
# mark down duration if we have a start time and a current time
- if 'start_time' in task_information.keys() and 'time' in vars(event):
- duration = event.time - task_information['start_time']
+ if 'start_time' in task_information.keys() and 'end_time' in task_information.keys():
+ duration = task_information['end_time'] - task_information['start_time']
task_object.elapsed_time = duration
task_object.save()
@@ -672,7 +672,6 @@ class BuildInfoHelper(object):
task_obj = self.orm_wrapper.get_update_task_object(task_information)
self.internal_state['taskdata'][identifier] = {
- 'start_time': datetime.datetime.now(),
'outcome': task_information['outcome'],
}
@@ -717,10 +716,13 @@ class BuildInfoHelper(object):
recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
task_information = self._get_task_information(event,recipe)
- if 'time' in vars(event) and isinstance(event, bb.build.TaskStarted):
- self.internal_state['taskdata'][identifier]['start_time'] = event.time
+ if 'time' in vars(event):
+ if not 'start_time' in self.internal_state['taskdata'][identifier]:
+ self.internal_state['taskdata'][identifier]['start_time'] = event.time
+ else:
+ task_information['end_time'] = event.time
+ task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time']
- task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time']
task_information['outcome'] = self.internal_state['taskdata'][identifier]['outcome']
if 'logfile' in vars(event):