diff options
author | Joel Fernandes <joelaf@google.com> | 2017-06-29 14:28:13 -0700 |
---|---|---|
committer | Joel Fernandes <joelaf@google.com> | 2017-06-29 14:28:13 -0700 |
commit | b0e013c24a4d59d21e8d078298f2d0f266bda611 (patch) | |
tree | 9e19949585eda295f17d9b2a9f25d6b10213c7e3 | |
parent | b5d85cef9db8fcb72fe152d37ad098363141b008 (diff) | |
download | trappy-b0e013c24a4d59d21e8d078298f2d0f266bda611.tar.gz |
Revert "trappy: Remove double check for unique word"
This reverts commit 9493bfaba69108b16db1ee21c53c7f0f95eec5ba.
-rw-r--r-- | trappy/ftrace.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/trappy/ftrace.py b/trappy/ftrace.py index 4bd0ae0..ea435f5 100644 --- a/trappy/ftrace.py +++ b/trappy/ftrace.py @@ -168,12 +168,20 @@ 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: - trace_class = None + if not contains_unique_word(line): + self.lines += 1 + continue for unique_word, cls in cls_for_unique_word.iteritems(): if unique_word in line: trace_class = cls @@ -181,8 +189,7 @@ subclassed by FTrace (for parsing FTrace coming from trace-cmd) and SysTrace.""" break else: if not trace_class: - self.lines += 1 - continue + raise FTraceParseError("No unique word in '{}'".format(line)) line = line[:-1] |