This module contains a class for managing efficiency/performance experiments.
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 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.
@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).)
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).