blob: 7bccb9caaa6809253377c2666039b2e8667a64cd [file] [log] [blame]
Kevin DuBoisb5108a12017-10-04 14:28:52 -07001# Copyright 2017 Google, ARM Limited
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16
17"""
18Definitions of common_clk (CONFIG_COMMON_CLK) trace parsers
19registered by the FTrace class
20"""
21
22from trappy.base import Base
23from trappy.dynamic import register_ftrace_parser, register_dynamic_ftrace
24
25class CommonClkBase(Base):
26 #clock traces are of the form "clk_name field0=x field1=y ..."
27 def generate_data_dict(self, data_str):
28 clk_name, fields = data_str.split(' ', 1)
29 ret = super(CommonClkBase, self).generate_data_dict(fields)
30 ret['clk_name'] = clk_name
31 return ret
32
33class CommonClkEnable(CommonClkBase):
34 """Corresponds to Linux kernel trace event clock_enable"""
35
36 unique_word = "clock_enable:"
37 """The unique word that will be matched in a trace line"""
38
39register_ftrace_parser(CommonClkEnable)
40
41class CommonClkDisable(CommonClkBase):
42 """Corresponds to Linux kernel trace event clock_disable"""
43
44 unique_word = "clock_disable:"
45 """The unique word that will be matched in a trace line"""
46
47register_ftrace_parser(CommonClkDisable)
48
49class CommonClkSetRate(CommonClkBase):
50 """Corresponds to Linux kernel trace event clock_set_rate"""
51
52 unique_word = "clock_set_rate:"
53 """The unique word that will be matched in a trace line"""
54
55 def finalize_object(self):
56 self.data_frame.rename(columns={'state':'rate'}, inplace=True)
57
58register_ftrace_parser(CommonClkSetRate)