diff options
author | René Stadler <mail@renestadler.de> | 2012-09-21 22:52:25 +0200 |
---|---|---|
committer | René Stadler <mail@renestadler.de> | 2012-09-21 22:53:53 +0200 |
commit | 25cfe9b511cd957578d43deb7e003626571ad4b5 (patch) | |
tree | 44f8c8006690b578bad6b51c447a1c62df14335d /GstDebugViewer/Plugins | |
parent | 481e0932407725ca842badd65a04df32db5eb490 (diff) |
timeline: make log level calculation a lot faster
This is the step where the timeline graph gets colored with the individual log
level colors. It's roughly 4.5 times faster now. Probably can be made even
better, the code also needs a cleanup.
Diffstat (limited to 'GstDebugViewer/Plugins')
-rw-r--r-- | GstDebugViewer/Plugins/Timeline.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/GstDebugViewer/Plugins/Timeline.py b/GstDebugViewer/Plugins/Timeline.py index 5eec14e..65a7aed 100644 --- a/GstDebugViewer/Plugins/Timeline.py +++ b/GstDebugViewer/Plugins/Timeline.py @@ -171,13 +171,26 @@ class LevelDistributionSentinel (object): if not partitions: return + level_index = 0 + level_iter = None + finished = False while tree_iter: y -= 1 if y == 0: y = YIELD_LIMIT yield True - level = model_get (tree_iter, id_level) + if level_iter is None: + stop_index = level_index + 512 + levels = self.model.get_value_range (id_level, + level_index, stop_index) + level_index = stop_index + level_iter = iter (levels) + try: + level = level_iter.next () + except StopIteration: + level_iter = None + continue while i > partitions[partitions_i]: data.append (tuple (counts)) counts = [0] * MAX_LEVELS @@ -189,7 +202,6 @@ class LevelDistributionSentinel (object): break counts[level] += 1 i += 1 - tree_iter = model_next (tree_iter) # Now handle the last one: data.append (tuple (counts)) |