diff options
author | Javi Merino <javi.merino@arm.com> | 2015-11-26 12:25:33 +0000 |
---|---|---|
committer | Javi Merino <javi.merino@arm.com> | 2015-11-26 12:30:04 +0000 |
commit | cd3fc6b96635ea9a624d9170a4db355d72ee2009 (patch) | |
tree | 910f7a082ea8dfc86363fa8710b02ce4b34e1a76 | |
parent | dc9626d43b054c17e948aaaa7aa65a5e8ffe0cfe (diff) | |
download | trappy-cd3fc6b96635ea9a624d9170a4db355d72ee2009.tar.gz |
base: remove the unique_word parameter from the constructor of Base
Now that unique_word is required to be a class variable of all
classes derived from Base there is no pass it to the constructor. Base
can already pick it up.
Thanks to this we can remove all the repeated code in the dummy
constructors.
-rw-r--r-- | tests/test_dynamic.py | 5 | ||||
-rw-r--r-- | trappy/base.py | 15 | ||||
-rw-r--r-- | trappy/cpu_power.py | 10 | ||||
-rw-r--r-- | trappy/devfreq_power.py | 6 | ||||
-rw-r--r-- | trappy/dynamic.py | 1 | ||||
-rw-r--r-- | trappy/pid_controller.py | 3 | ||||
-rw-r--r-- | trappy/sched.py | 20 | ||||
-rw-r--r-- | trappy/thermal.py | 8 |
8 files changed, 8 insertions, 60 deletions
diff --git a/tests/test_dynamic.py b/tests/test_dynamic.py index 9a37834..9ba0421 100644 --- a/tests/test_dynamic.py +++ b/tests/test_dynamic.py @@ -29,11 +29,6 @@ class DynamicEvent(Base): unique_word = "dynamic_test_key" name = "dynamic_event" - def __init__(self): - super(DynamicEvent, self).__init__( - unique_word=self.unique_word, - ) - class TestDynamicEvents(BaseTestSched): diff --git a/trappy/base.py b/trappy/base.py index 419e15f..8afef45 100644 --- a/trappy/base.py +++ b/trappy/base.py @@ -71,20 +71,21 @@ def trace_parser_explode_array(string, array_lengths): class Base(object): """Base class to parse trace.dat dumps. - Don't use directly, create a subclass that defines the unique_word - you want to match in the output - - :param unique_word: Unique Word to identify the event in the trace - :type unique_word: str + Don't use directly, create a subclass that has a unique_word class + variable. unique_word is a string that can uniquely identify + lines in the trace that correspond to this event. This is usually + the trace_name (optionally followed by a semicolong, + e.g. "sched_switch:") but it can be anything else for trace points + generated using trace_printk(). :param parse_raw: If :code:`True`, raw trace data (-R option) to trace-cmd will be used This class acts as a base class for all TRAPpy events + """ - def __init__(self, unique_word, parse_raw=False): + def __init__(self, parse_raw=False): self.data_frame = pd.DataFrame() - self.unique_word = unique_word self.data_array = [] self.time_array = [] self.comm_array = [] diff --git a/trappy/cpu_power.py b/trappy/cpu_power.py index 1ffcd00..6e6df74 100644 --- a/trappy/cpu_power.py +++ b/trappy/cpu_power.py @@ -106,11 +106,6 @@ class CpuOutPower(Base): pivot = "cpus" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(CpuOutPower, self).__init__( - unique_word=self.unique_word, - ) - def get_all_freqs(self, mapping_label): """Get a :mod:`pandas.DataFrame` with the maximum frequencies allowed by the governor @@ -141,11 +136,6 @@ class CpuInPower(Base): pivot = "cpus" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(CpuInPower, self).__init__( - unique_word=self.unique_word, - ) - def _get_load_series(self): """get a :mod:`pandas.Series` with the aggregated load""" diff --git a/trappy/devfreq_power.py b/trappy/devfreq_power.py index 6bed7de..0d34d4d 100644 --- a/trappy/devfreq_power.py +++ b/trappy/devfreq_power.py @@ -34,9 +34,6 @@ FTrace dump""" unique_word="thermal_power_devfreq_get_power:" """The event name in the trace""" - def __init__(self): - super(DevfreqInPower, self).__init__(unique_word=self.unique_word) - def get_all_freqs(self): """Return a :mod:`pandas.DataFrame` with the frequencies for the devfreq device @@ -63,9 +60,6 @@ ftrace dump""" unique_word="thermal_power_devfreq_limit:" """The event name in the trace""" - def __init__(self): - super(DevfreqOutPower, self).__init__(unique_word=self.unique_word) - def get_all_freqs(self): """Return a :mod:`pandas.DataFrame` with the output frequencies for the devfreq device diff --git a/trappy/dynamic.py b/trappy/dynamic.py index 91f92e3..1213ad0 100644 --- a/trappy/dynamic.py +++ b/trappy/dynamic.py @@ -32,7 +32,6 @@ def default_init(self): """ super(type(self), self).__init__( - unique_word=self.unique_word, parse_raw=self.parse_raw ) diff --git a/trappy/pid_controller.py b/trappy/pid_controller.py index 1d55519..3376b13 100644 --- a/trappy/pid_controller.py +++ b/trappy/pid_controller.py @@ -33,9 +33,6 @@ class PIDController(Base): unique_word="thermal_power_allocator_pid" """The event name in the trace""" - def __init__(self): - super(PIDController, self).__init__(unique_word=self.unique_word) - def plot_controller(self, title="", width=None, height=None, ax=None): """Plot a summary of the controller data diff --git a/trappy/sched.py b/trappy/sched.py index b8fe131..12f9786 100644 --- a/trappy/sched.py +++ b/trappy/sched.py @@ -35,11 +35,6 @@ class SchedLoadAvgSchedGroup(Base): pivot = "cpus" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(SchedLoadAvgSchedGroup, self).__init__( - unique_word=self.unique_word, - ) - def finalize_object(self): """This condition is necessary to force column 'cpus' to be printed as 8 digits w/ leading 0 @@ -63,11 +58,6 @@ class SchedLoadAvgTask(Base): pivot = "pid" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(SchedLoadAvgTask, self).__init__( - unique_word=self.unique_word, - ) - def get_pids(self, key=""): """Returns a list of (comm, pid) that contain 'key' in their 'comm'.""" @@ -103,11 +93,6 @@ class SchedCpuCapacity(Base): pivot = "cpu" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(SchedCpuCapacity, self).__init__( - unique_word=self.unique_word, - ) - def finalize_object(self): """This renaming is necessary because our cpu related pivot is 'cpu' and not 'cpu_id'. Otherwise you cannot 'mix and match' with other @@ -138,11 +123,6 @@ class SchedCpuFrequency(Base): pivot = "cpu" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(SchedCpuFrequency, self).__init__( - unique_word=self.unique_word, - ) - def finalize_object(self): """This renaming is necessary because our cpu related pivot is 'cpu' and not 'cpu_id'. Otherwise you cannot 'mix and match' with other diff --git a/trappy/thermal.py b/trappy/thermal.py index 7c60ba1..44c67f5 100644 --- a/trappy/thermal.py +++ b/trappy/thermal.py @@ -38,9 +38,6 @@ class Thermal(Base): pivot = "id" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(Thermal, self).__init__(unique_word=self.unique_word) - def plot_temperature(self, control_temperature=None, title="", width=None, height=None, ylim="range", ax=None, legend_label=""): """Plot the temperature. @@ -119,11 +116,6 @@ class ThermalGovernor(Base): pivot = "thermal_zone_id" """The Pivot along which the data is orthogonal""" - def __init__(self): - super(ThermalGovernor, self).__init__( - unique_word=self.unique_word, - ) - def plot_temperature(self, title="", width=None, height=None, ylim="range", ax=None, legend_label=""): """Plot the temperature""" |