blob: 3d4cfca6b20da894f71ce88b8efa73273ebdb760 [file] [log] [blame]
Kevin DuBoisb5108a12017-10-04 14:28:52 -07001# Copyright 2017 ARM Limited, Google
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
16import os
17import sys
18
19import utils_tests
20import trappy
21
22sys.path.append(os.path.join(utils_tests.TESTS_DIRECTORY, "..", "trappy"))
23
24class TestCommonClk(utils_tests.SetupDirectory):
25 def __init__(self, *args, **kwargs):
26 super(TestCommonClk, self).__init__(
27 [("trace_common_clk.txt", "trace_common_clk.txt"),],
28 *args,
29 **kwargs)
30
31 def test_common_clk_set_rate_can_be_parsed(self):
32 """TestCommonClk: test that clock__set_rate events can be parsed"""
33 trace = trappy.FTrace("trace_common_clk.txt", events=['clock_set_rate'])
34 df = trace.clock_set_rate.data_frame
35 self.assertSetEqual(set(df.columns),
Kevin DuBois9ea1d012017-10-24 16:05:55 -070036 set(["__comm", "__cpu", "__line", "__pid", "__tgid", "cpu_id", "clk_name", "rate"]))
Kevin DuBoisb5108a12017-10-04 14:28:52 -070037
38 def test_common_clk_enable_can_be_parsed(self):
39 """TestCommonClk: test that clock_enable events can be parsed"""
40 trace = trappy.FTrace("trace_common_clk.txt", events=['clock_enable'])
41 df = trace.clock_enable.data_frame
42 self.assertSetEqual(set(df.columns),
Kevin DuBois9ea1d012017-10-24 16:05:55 -070043 set(["__comm", "__cpu", "__line", "__pid", "__tgid", "cpu_id", "clk_name", "state"]))
Kevin DuBoisb5108a12017-10-04 14:28:52 -070044
45 def test_common_clk_disable_can_be_parsed(self):
46 """TestCommonClk: test that clock_disable events can be parsed"""
47 trace = trappy.FTrace("trace_common_clk.txt", events=['clock_disable'])
48 df = trace.clock_disable.data_frame
49 self.assertSetEqual(set(df.columns),
Kevin DuBois9ea1d012017-10-24 16:05:55 -070050 set(["__comm", "__cpu", "__line", "__pid", "__tgid", "cpu_id", "clk_name", "state"]))