blob: a8a0ac1cb90880686615a6145ac9a156f521fa30 [file] [log] [blame]
Brendan Jackmane81fdcb2017-01-04 17:10:29 +00001# Copyright 2015-2017 ARM Limited
Javi Merino766ed3f2015-04-22 17:07:42 +01002#
Javi Merinoaace7c02015-08-10 14:10:47 +01003# 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
Javi Merino766ed3f2015-04-22 17:07:42 +010016
17"""Process the output of the devfreq_cooling devices in the current
18directory's trace.dat"""
19
Javi Merino9c9867d2015-06-24 13:24:41 +010020import pandas as pd
21
Javi Merino435457c2015-08-10 15:59:10 +010022from trappy.base import Base
Javi Merino094e7422016-03-22 11:53:55 +000023from trappy.dynamic import register_ftrace_parser
Javi Merino766ed3f2015-04-22 17:07:42 +010024
25
26class DevfreqInPower(Base):
27 """Process de devfreq cooling device data regarding get_power in an
Kapileshwar Singh95985b52015-09-09 14:50:37 +010028FTrace dump"""
Javi Merino766ed3f2015-04-22 17:07:42 +010029
30 name = "devfreq_in_power"
Kapileshwar Singh95985b52015-09-09 14:50:37 +010031 """The name of the :mod:`pandas.DataFrame` member that will be created in a
Javi Merinoc26a3232015-12-11 18:00:30 +000032 :mod:`trappy.ftrace.FTrace` object"""
Javi Merino766ed3f2015-04-22 17:07:42 +010033
Javi Merinodc9626d2015-11-26 11:08:50 +000034 unique_word="thermal_power_devfreq_get_power:"
35 """The event name in the trace"""
36
Javi Merino766ed3f2015-04-22 17:07:42 +010037 def get_all_freqs(self):
Kapileshwar Singh95985b52015-09-09 14:50:37 +010038 """Return a :mod:`pandas.DataFrame` with
39 the frequencies for the devfreq device
Javi Merino766ed3f2015-04-22 17:07:42 +010040
41 The format should be the same as the one for
Kapileshwar Singh95985b52015-09-09 14:50:37 +010042 :code:`CpuInPower().get_all_freqs()`.
Javi Merino766ed3f2015-04-22 17:07:42 +010043
Kapileshwar Singh95985b52015-09-09 14:50:37 +010044 .. note:: Frequencies are in MHz.
Javi Merino766ed3f2015-04-22 17:07:42 +010045 """
46
Javi Merino9c9867d2015-06-24 13:24:41 +010047 return pd.DataFrame(self.data_frame["freq"] / 1000000)
Javi Merino766ed3f2015-04-22 17:07:42 +010048
Javi Merino094e7422016-03-22 11:53:55 +000049register_ftrace_parser(DevfreqInPower, "thermal")
Javi Merino766ed3f2015-04-22 17:07:42 +010050
51
52class DevfreqOutPower(Base):
53 """Process de devfreq cooling device data regarding power2state in an
54ftrace dump"""
55
56 name = "devfreq_out_power"
Kapileshwar Singh95985b52015-09-09 14:50:37 +010057 """The name of the :mod:`pandas.DataFrame` member that will be created in a
Javi Merinoc26a3232015-12-11 18:00:30 +000058 :mod:`trappy.ftrace.FTrace` object"""
Javi Merino766ed3f2015-04-22 17:07:42 +010059
Javi Merinodc9626d2015-11-26 11:08:50 +000060 unique_word="thermal_power_devfreq_limit:"
61 """The event name in the trace"""
62
Javi Merino766ed3f2015-04-22 17:07:42 +010063 def get_all_freqs(self):
Kapileshwar Singh95985b52015-09-09 14:50:37 +010064 """Return a :mod:`pandas.DataFrame` with
65 the output frequencies for the devfreq device
Javi Merino766ed3f2015-04-22 17:07:42 +010066
Kapileshwar Singh95985b52015-09-09 14:50:37 +010067 The format should be the same as the one for
68 :code:`CpuOutPower().get_all_freqs()`.
Javi Merino766ed3f2015-04-22 17:07:42 +010069
Kapileshwar Singh95985b52015-09-09 14:50:37 +010070 .. note:: Frequencies are in MHz.
Javi Merino766ed3f2015-04-22 17:07:42 +010071 """
72
Javi Merino9c9867d2015-06-24 13:24:41 +010073 return pd.DataFrame(self.data_frame["freq"] / 1000000)
Javi Merino766ed3f2015-04-22 17:07:42 +010074
Javi Merino094e7422016-03-22 11:53:55 +000075register_ftrace_parser(DevfreqOutPower, "thermal")