143bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# Copyright 2017 ARM Limited, Google and contributors 243bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# 343bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# Licensed under the Apache License, Version 2.0 (the "License"); 443bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# you may not use this file except in compliance with the License. 543bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# You may obtain a copy of the License at 643bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# 743bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# http://www.apache.org/licenses/LICENSE-2.0 843bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# 943bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# Unless required by applicable law or agreed to in writing, software 1043bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# distributed under the License is distributed on an "AS IS" BASIS, 1143bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1243bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# See the License for the specific language governing permissions and 1343bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# limitations under the License. 1443bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes# 1543bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 1643bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes"""This module contains the class for representing a tracing_mark_write 1743bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandestrace_event used for ftrace events injected from userspace. 1843bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes""" 1943bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 2043bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandesfrom trappy.base import Base 2143bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandesfrom trappy.dynamic import register_ftrace_parser 2243bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 2343bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandesclass TracingMarkWrite(Base): 2443bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes """Parse tracing_mark_write events that couldn't be matched with more specific unique words 2543bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes This class is always used as a fallback if nothing more specific could match the particular 2643bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes tracing_mark_write event. 2743bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes """ 2843bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 2943bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes unique_word = "tracing_mark_write" 3043bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 3143bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes def generate_data_dict(self, data_str): 3243bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes if self.tracer: 3343bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes data_dict = self.tracer.generate_data_dict(data_str) 3443bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes if data_dict: 3543bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes return data_dict 3643bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 3743bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes data_dict = { 'string': data_str } 3843bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes return data_dict 3943bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandes 40071bbff272362e8f0eeb027ba7b148070b465403Joel Fernandes def __init__(self): 41071bbff272362e8f0eeb027ba7b148070b465403Joel Fernandes super(TracingMarkWrite, self).__init__(fallback=True) 42071bbff272362e8f0eeb027ba7b148070b465403Joel Fernandes 4343bb10340af5eaa41eb70c0fc8e3cb245e3f56bbJoel Fernandesregister_ftrace_parser(TracingMarkWrite) 44