aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fernandes <joelaf@google.com>2017-06-25 12:45:24 -0700
committerKP Singh <kpsingh@google.com>2017-06-29 23:10:41 +0200
commit677e6e5471b4d20270b8a7a839b6c0a961f7fc3e (patch)
tree0c0ef346b28c237c61f495d42e3522c6a5a642fc
parent634bcd3bc8fff3803b8c62d03bde63bbdac1c034 (diff)
downloadtrappy-677e6e5471b4d20270b8a7a839b6c0a961f7fc3e.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> Reviewed-by: KP Singh <kpsingh@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 06e2a93..ab9ed0a 100644
--- a/trappy/ftrace.py
+++ b/trappy/ftrace.py
@@ -252,20 +252,12 @@ subclassed by FTrace (for parsing FTrace coming from trace-cmd) and SysTrace."""
def __populate_data(self, fin, cls_for_unique_word):
"""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
@@ -273,7 +265,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]