systrace: Fix broken regex
The regex is broken for strings like this:
C|594|HW_VSYNC_ON_0|1
This is because the "1" (data) is optional and so the greedy operator globs everything causing
func = "HW_VSYNC_ON_0|1" and data = NaN
Change the data to be greedy until '|' is encountered so with that:
func = "HW_VSYNC_ON_0" and data = "1".
Change-Id: I3695a8da8ad10598192cea08ca92e27271565ccf
Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-by: KP Singh <kpsingh@google.com>
diff --git a/trappy/systrace.py b/trappy/systrace.py
index 0a7f42b..ab2e29c 100644
--- a/trappy/systrace.py
+++ b/trappy/systrace.py
@@ -17,7 +17,7 @@
import re
SYSTRACE_EVENT = re.compile(
- r'^(?P<event>[A-Z])(\|(?P<pid>\d+)\|(?P<func>.*)(\|(?P<data>\d+))?)?')
+ r'^(?P<event>[A-Z])(\|(?P<pid>\d+)\|(?P<func>[^|]*)(\|(?P<data>.*))?)?')
class drop_before_trace(object):
"""Object that, when called, returns True if the line is not part of