From db6e903112f0f5b2c5c66a63a5d3cdf35d0a6f55 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Wed, 11 May 2016 11:49:33 +0100 Subject: [PATCH] libs/utils/trace: compute time ranges for plot window If the user does not want the time to be normalized we need to compute the plot window range boundaries. Also, the user could specify a window tuple with start and end times. These values are relative to the basetime of the trace and therefore the plot window boundaries are computed accordingly. Signed-off-by: Michele Di Giorgio --- libs/utils/trace.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/utils/trace.py b/libs/utils/trace.py index 510b3e97b..38e157b79 100644 --- a/libs/utils/trace.py +++ b/libs/utils/trace.py @@ -124,6 +124,15 @@ class Trace(object): self.__loadTasksNames(tasks) + # Compute plot window + if not normalize_time: + start = self.window[0] + if self.window[1]: + duration = min(self.ftrace.get_duration(), self.window[1]) + else: + duration = self.ftrace.get_duration() + self.window = (self.ftrace.basetime + start, + self.ftrace.basetime + duration) def __checkAvailableEvents(self, key=""): for val in self.ftrace.get_filters(key): -- GitLab