aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fernandes <joelaf@google.com>2017-06-25 12:45:24 -0700
committerJoel Fernandes <joelaf@google.com>2017-06-25 12:47:57 -0700
commit9493bfaba69108b16db1ee21c53c7f0f95eec5ba (patch)
tree8987d55402c3282f282e23c4b0b718178e89c719
parent0681f9403826ae685aec5ed6d16926146aea7049 (diff)
downloadtrappy-9493bfaba69108b16db1ee21c53c7f0f95eec5ba.tar.gz
trappy: Remove double check for unique word
Its not necessary to check for unique word twice. Reusing the 'class detection' path for this purpose is sufficient. This improve performance by 3-6% of the parsing stage. Change-Id: Iff8ebd0086d2ccc10bec14e3d40a63f3c04aaf1a Signed-off-by: Joel Fernandes <joelaf@google.com>
-rw-r--r--trappy/ftrace.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/trappy/ftrace.py b/trappy/ftrace.py
index 6a31ec3..ee5efec 100644
--- a/trappy/ftrace.py
+++ b/trappy/ftrace.py
@@ -168,20 +168,12 @@ subclassed by FTrace (for parsing FTrace coming from trace-cmd) and SysTrace."""
def __populate_data(self, fin, cls_for_unique_word, window, abs_window):
"""Append to trace data from a txt trace"""
- def contains_unique_word(line, unique_words=cls_for_unique_word.keys()):
- for unique_word in unique_words:
- if unique_word in line:
- return True
- return False
-
actual_trace = itertools.dropwhile(self.trace_hasnt_started(), fin)
actual_trace = itertools.takewhile(self.trace_hasnt_finished(),
actual_trace)
for line in actual_trace:
- if not contains_unique_word(line):
- self.lines += 1
- continue
+ trace_class = None
for unique_word, cls in cls_for_unique_word.iteritems():
if unique_word in line:
trace_class = cls
@@ -189,7 +181,8 @@ subclassed by FTrace (for parsing FTrace coming from trace-cmd) and SysTrace."""
break
else:
if not trace_class:
- raise FTraceParseError("No unique word in '{}'".format(line))
+ self.lines += 1
+ continue
line = line[:-1]