trappy: Add tracing_mark_write as a new event

Create tracing_mark_write as an event and treat it like such. It overrides data
string processing since it cannot use 'key=value' parsing. Instead it relies on
the tracer to provide one (such as systrace has custom trace format from
userspace events). If tracer cannot provide one, then it just returns a default
dictionary with key 'string' and value as the string in the event.

Signed-off-by: Joel Fernandes <joelaf@google.com>
Reviewed-by: KP Singh <kpsingh@google.com>
diff --git a/trappy/tracing_mark_write.py b/trappy/tracing_mark_write.py
new file mode 100644
index 0000000..9f10cbc
--- /dev/null
+++ b/trappy/tracing_mark_write.py
@@ -0,0 +1,40 @@
+#    Copyright 2017 ARM Limited, Google and contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""This module contains the class for representing a tracing_mark_write
+trace_event used for ftrace events injected from userspace.
+"""
+
+from trappy.base import Base
+from trappy.dynamic import register_ftrace_parser
+
+class TracingMarkWrite(Base):
+    """Parse tracing_mark_write events that couldn't be matched with more specific unique words
+       This class is always used as a fallback if nothing more specific could match the particular
+       tracing_mark_write event.
+    """
+
+    unique_word = "tracing_mark_write"
+
+    def generate_data_dict(self, data_str):
+        if self.tracer:
+            data_dict = self.tracer.generate_data_dict(data_str)
+            if data_dict:
+                return data_dict
+
+        data_dict = { 'string': data_str }
+        return data_dict
+
+register_ftrace_parser(TracingMarkWrite)