1e81fdcb135d0325e3bc22fae0583555d20aae280Brendan Jackman# Copyright 2015-2017 ARM Limited 2766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino# 3aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# Licensed under the Apache License, Version 2.0 (the "License"); 4aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# you may not use this file except in compliance with the License. 5aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# You may obtain a copy of the License at 6aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# 7aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# http://www.apache.org/licenses/LICENSE-2.0 8aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# 9aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# Unless required by applicable law or agreed to in writing, software 10aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# distributed under the License is distributed on an "AS IS" BASIS, 11aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# See the License for the specific language governing permissions and 13aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# limitations under the License. 14aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino# 15aace7c0732cac769f1ffe95a89591b6217fa9447Javi Merino 16766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 17766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino"""Process the output of the devfreq_cooling devices in the current 18766ed3fea6b82594427892ecca722ef1acad72eaJavi Merinodirectory's trace.dat""" 19766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 209c9867d383799ae84367396fd1dd8e471c0fbd28Javi Merinoimport pandas as pd 219c9867d383799ae84367396fd1dd8e471c0fbd28Javi Merino 22435457c8af9d69383ba45e0bd7da022d967a8deaJavi Merinofrom trappy.base import Base 23094e742d3504d692e74913ed85ec3d4b176f0469Javi Merinofrom trappy.dynamic import register_ftrace_parser 24766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 25766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 26766ed3fea6b82594427892ecca722ef1acad72eaJavi Merinoclass DevfreqInPower(Base): 27766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino """Process de devfreq cooling device data regarding get_power in an 2895985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar SinghFTrace dump""" 29766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 30766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino name = "devfreq_in_power" 3195985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh """The name of the :mod:`pandas.DataFrame` member that will be created in a 32c26a323210533d4ed3a8b4e62c33744236e3bedaJavi Merino :mod:`trappy.ftrace.FTrace` object""" 33766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 34dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfeJavi Merino unique_word="thermal_power_devfreq_get_power:" 35dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfeJavi Merino """The event name in the trace""" 36dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfeJavi Merino 37766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino def get_all_freqs(self): 3895985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh """Return a :mod:`pandas.DataFrame` with 3995985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh the frequencies for the devfreq device 40766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 41766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino The format should be the same as the one for 4295985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh :code:`CpuInPower().get_all_freqs()`. 43766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 4495985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh .. note:: Frequencies are in MHz. 45766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino """ 46766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 479c9867d383799ae84367396fd1dd8e471c0fbd28Javi Merino return pd.DataFrame(self.data_frame["freq"] / 1000000) 48766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 49094e742d3504d692e74913ed85ec3d4b176f0469Javi Merinoregister_ftrace_parser(DevfreqInPower, "thermal") 50766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 51766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 52766ed3fea6b82594427892ecca722ef1acad72eaJavi Merinoclass DevfreqOutPower(Base): 53766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino """Process de devfreq cooling device data regarding power2state in an 54766ed3fea6b82594427892ecca722ef1acad72eaJavi Merinoftrace dump""" 55766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 56766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino name = "devfreq_out_power" 5795985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh """The name of the :mod:`pandas.DataFrame` member that will be created in a 58c26a323210533d4ed3a8b4e62c33744236e3bedaJavi Merino :mod:`trappy.ftrace.FTrace` object""" 59766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 60dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfeJavi Merino unique_word="thermal_power_devfreq_limit:" 61dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfeJavi Merino """The event name in the trace""" 62dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfeJavi Merino 63766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino def get_all_freqs(self): 6495985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh """Return a :mod:`pandas.DataFrame` with 6595985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh the output frequencies for the devfreq device 66766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 6795985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh The format should be the same as the one for 6895985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh :code:`CpuOutPower().get_all_freqs()`. 69766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 7095985b5125b3e96b8cd87460cc375600a8de49eaKapileshwar Singh .. note:: Frequencies are in MHz. 71766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino """ 72766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 739c9867d383799ae84367396fd1dd8e471c0fbd28Javi Merino return pd.DataFrame(self.data_frame["freq"] / 1000000) 74766ed3fea6b82594427892ecca722ef1acad72eaJavi Merino 75094e742d3504d692e74913ed85ec3d4b176f0469Javi Merinoregister_ftrace_parser(DevfreqOutPower, "thermal") 76