Javi Merino | aace7c0 | 2015-08-10 14:10:47 +0100 | [diff] [blame^] | 1 | # Copyright 2015-2015 ARM Limited |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 2 | # |
Javi Merino | aace7c0 | 2015-08-10 14:10:47 +0100 | [diff] [blame^] | 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 | |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 16 | |
| 17 | """Process the output of the devfreq_cooling devices in the current |
| 18 | directory's trace.dat""" |
| 19 | |
Javi Merino | 9c9867d | 2015-06-24 13:24:41 +0100 | [diff] [blame] | 20 | import pandas as pd |
| 21 | |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 22 | from cr2.base import Base |
| 23 | from cr2.run import Run |
| 24 | |
| 25 | |
| 26 | class DevfreqInPower(Base): |
| 27 | """Process de devfreq cooling device data regarding get_power in an |
| 28 | ftrace 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 Merino | 9c9867d | 2015-06-24 13:24:41 +0100 | [diff] [blame] | 38 | """Return a pandas.DataFrame with the frequencies for the devfreq device |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 39 | |
| 40 | The format should be the same as the one for |
| 41 | CpuInPower().get_all_freqs(). Frequencies are in MHz. |
| 42 | |
| 43 | """ |
| 44 | |
Javi Merino | 9c9867d | 2015-06-24 13:24:41 +0100 | [diff] [blame] | 45 | return pd.DataFrame(self.data_frame["freq"] / 1000000) |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 46 | |
| 47 | Run.register_class(DevfreqInPower, "thermal") |
| 48 | |
| 49 | |
| 50 | class DevfreqOutPower(Base): |
| 51 | """Process de devfreq cooling device data regarding power2state in an |
| 52 | ftrace 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 Merino | 9c9867d | 2015-06-24 13:24:41 +0100 | [diff] [blame] | 62 | """Return a pandas.DataFrame with the output frequencies for the devfreq |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 63 | device |
| 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 Merino | 9c9867d | 2015-06-24 13:24:41 +0100 | [diff] [blame] | 70 | return pd.DataFrame(self.data_frame["freq"] / 1000000) |
Javi Merino | 766ed3f | 2015-04-22 17:07:42 +0100 | [diff] [blame] | 71 | |
| 72 | Run.register_class(DevfreqOutPower, "thermal") |