blob: a5afafdae43141fa27039a8c2ef382776b9cfeca [file] [log] [blame]
Javi Merinoaace7c02015-08-10 14:10:47 +01001# Copyright 2015-2015 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 Merino766ed3f2015-04-22 17:07:42 +010022from cr2.base import Base
23from cr2.run import Run
24
25
26class DevfreqInPower(Base):
27 """Process de devfreq cooling device data regarding get_power in an
28ftrace dump"""
29
30 name = "devfreq_in_power"
31
32 def __init__(self):
33 super(DevfreqInPower, self).__init__(
34 unique_word="thermal_power_devfreq_get_power:",
35 )
36
37 def get_all_freqs(self):
Javi Merino9c9867d2015-06-24 13:24:41 +010038 """Return a pandas.DataFrame with the frequencies for the devfreq device
Javi Merino766ed3f2015-04-22 17:07:42 +010039
40 The format should be the same as the one for
41 CpuInPower().get_all_freqs(). Frequencies are in MHz.
42
43 """
44
Javi Merino9c9867d2015-06-24 13:24:41 +010045 return pd.DataFrame(self.data_frame["freq"] / 1000000)
Javi Merino766ed3f2015-04-22 17:07:42 +010046
47Run.register_class(DevfreqInPower, "thermal")
48
49
50class DevfreqOutPower(Base):
51 """Process de devfreq cooling device data regarding power2state in an
52ftrace dump"""
53
54 name = "devfreq_out_power"
55
56 def __init__(self):
57 super(DevfreqOutPower, self).__init__(
58 unique_word="thermal_power_devfreq_limit:",
59 )
60
61 def get_all_freqs(self):
Javi Merino9c9867d2015-06-24 13:24:41 +010062 """Return a pandas.DataFrame with the output frequencies for the devfreq
Javi Merino766ed3f2015-04-22 17:07:42 +010063device
64
65 The format should be the same that that of
66 CpuOutPower().get_all_freqs(). The frequencies are in MHz.
67
68 """
69
Javi Merino9c9867d2015-06-24 13:24:41 +010070 return pd.DataFrame(self.data_frame["freq"] / 1000000)
Javi Merino766ed3f2015-04-22 17:07:42 +010071
72Run.register_class(DevfreqOutPower, "thermal")