module benchmark.profiler_class
¶
Short summary¶
module pymlbenchmark.benchmark.profiler_class
Implements a benchmark about performance.
Classes¶
class |
truncated documentation |
---|---|
Runs a profiler on a specific call. It can use either pyinstrument, either cProfile. The first module … |
Methods¶
method |
truncated documentation |
---|---|
Iterates on stored profiled. Returns a couple |
|
Returns the number of stored profiles. |
|
Tells if the profiler should be run on this set of parameters. |
|
Profiles function fct, calls it repeat times. |
|
Saves all profiles into one file. |
Documentation¶
Implements a benchmark about performance.
- class pymlbenchmark.benchmark.profiler_class.ProfilerCall(fct_match=None, name='ProfilerCall', repeat=1000, interval=0.0001, module='pyinstrument')¶
Bases:
object
Runs a profiler on a specific call. It can use either pyinstrument, either cProfile. The first module takes a snapshot every interval and stores the call stack. That explains why not all called functions appear in the summary but the overhead is smaller.
- Parameters:
fct_match – function which tells if the profiler should be run on a set of parameters, signature is
match(**kwargs) -> boolean
repeat – number of times to repeat the function to profile
name – name of the profile
interval – see interval
module –
'pyinstrument'
by default,'cProfile'
or'profile'
works too
- __init__(fct_match=None, name='ProfilerCall', repeat=1000, interval=0.0001, module='pyinstrument')¶
- Parameters:
fct_match – function which tells if the profiler should be run on a set of parameters, signature is
match(**kwargs) -> boolean
repeat – number of times to repeat the function to profile
name – name of the profile
interval –
see interval
module –
'pyinstrument'
by default,'cProfile'
or'profile'
works too
- __iter__()¶
Iterates on stored profiled. Returns a couple
(profile, configuration)
.
- __len__()¶
Returns the number of stored profiles.
- match(**kwargs)¶
Tells if the profiler should be run on this set of parameters.
- Parameters:
kwargs – dictionary of parameters
- Returns:
boolean
- profile(fct, **kwargs)¶
Profiles function fct, calls it repeat times.
- Parameters:
fct – function to profile (no argument)
kwargs – stores additional information about the profiling
- to_txt(filename)¶
Saves all profiles into one file.
- Parameters:
filename – filename where to save the profiles, can be a stream