scitools.EfficiencyTable

This module contains a class for managing efficiency/performance experiments.

class scitools.EfficiencyTable.EfficiencyTable(description, normalization_time=None)[source]

Manage the CPU times of efficiency experiments and make tabular reports with sorted results.

>>> e = EfficiencyTable('some description of the experiments')
>>> e.add('about an experiment', cpu_time)
>>> e.add('about another experiment', cpu_time)
>>> e.add('about a third experiment', cpu_time)
>>> print e  # prints a sorted table with scaled CPU times
>>> e += e2  # add experiments from EfficiencyTable e2 to e

Methods

add(description, CPU_time[, function_name]) Add the CPU time of an experiment, together with a description
set_normalization_time(t) Set the CPU time by which all other CPU times will be divided.
__add__(other)[source]

As e += table (see __iadd__).

__iadd__(other)[source]

Add results in other to present results. New items (descriptions) are simply registered, while identical items (descriptions) will have a list of CPU times, corresponding to the different EfficiencyTable instances.

__init__(description, normalization_time=None)[source]

@param description: a string acting as headline for this test. @param normalization_time: all CPU times will be divided by this value (if not set, the class will find the smallest (best) CPU time and divide all others by this value.

The best_time parameter can also be set in the set_normalization_time method. The normalization time is not used before an instance is printed (str method).)

__module__ = 'scitools.EfficiencyTable'
__str__()[source]

Print out a sorted list (with respect to CPU times) of the experiments. In case of multiple CPU times per description of an experiment, the table is sorted with respect to the first CPU time entry of each multiple CPU times list. All CPU times are divided by a normalization time, which is given to the constructor or to the set_normalization_time method, or if not prescribed, this class finds the smallest reliable CPU time (neglecting very small CPU time).

add(description, CPU_time, function_name=None)[source]

Add the CPU time of an experiment, together with a description and an optional function_name (which is appended to the description string).

set_normalization_time(t)[source]

Set the CPU time by which all other CPU times will be divided. By default, this is the maximum CPU time encountered in the data.

scitools.EfficiencyTable.plot(filename)[source]

This Page