trappy.cpu_power module

Process the output of the cpu_cooling devices in the current directory’s trace.dat

class trappy.cpu_power.CpuInPower(parse_raw=False)[source]

Bases: trappy.base.Base

Process the cpufreq cooling power actor data in a ftrace dump

get_all_freqs(mapping_label)[source]

get a pandas.DataFrame with the “in” frequencies as seen by the governor

Note

Frequencies are in MHz

get_load_data(mapping_label)[source]

Return pandas.DataFrame suitable for plot_load()

Parameters:mapping_label (dict) – A Dictionary mapping cluster cpumasks to labels
get_normalized_load_data(mapping_label)[source]

Return a pandas.DataFrame for plotting normalized load data

Parameters:mapping_label (dict) – should be a dictionary mapping cluster cpumasks to labels
name = 'cpu_in_power'

The name of the pandas.DataFrame member that will be created in a trappy.ftrace.FTrace object

pivot = 'cpus'

The Pivot along which the data is orthogonal

unique_word = 'thermal_power_cpu_get'

The unique word that will be matched in a trace line

class trappy.cpu_power.CpuOutPower(parse_raw=False)[source]

Bases: trappy.base.Base

Process the cpufreq cooling power actor data in a ftrace dump

get_all_freqs(mapping_label)[source]

Get a pandas.DataFrame with the maximum frequencies allowed by the governor

Parameters:mapping_label (dict) – A dictionary that maps cpumasks to name of the cpu.
Returns:freqs are in MHz
name = 'cpu_out_power'

The name of the pandas.DataFrame member that will be created in a trappy.ftrace.FTrace object

pivot = 'cpus'

The Pivot along which the data is orthogonal

unique_word = 'thermal_power_cpu_limit'

The unique word that will be matched in a trace line

trappy.cpu_power.num_cpus_in_mask(mask)[source]

Return the number of cpus in a cpumask

trappy.cpu_power.pivot_with_labels(dfr, data_col_name, new_col_name, mapping_label)[source]

Pivot a pandas.DataFrame row into columns

Parameters:
  • dfr (pandas.DataFrame) – The pandas.DataFrame to operate on.
  • data_col_name (str) – The name of the column in the pandas.DataFrame which contains the values.
  • new_col_name (str) – The name of the column in the pandas.DataFrame that will become the new columns.
  • mapping_label (dict) – A dictionary whose keys are the values in new_col_name and whose values are their corresponding name in the pandas.DataFrame to be returned.

Example:

>>> dfr_in = pd.DataFrame({'cpus': ["000000f0",
>>>                                 "0000000f",
>>>                                 "000000f0",
>>>                                 "0000000f"
>>>                                 ],
>>>                        'freq': [1, 3, 2, 6]})
>>> dfr_in
       cpus  freq
0  000000f0     1
1  0000000f     3
2  000000f0     2
3  0000000f     6
>>> map_label = {"000000f0": "A15", "0000000f": "A7"}
>>> power.pivot_with_labels(dfr_in, "freq", "cpus", map_label)
   A15  A7
0    1 NaN
1    1   3
2    2   3
3    2   6