module benchmark.profiler_class

Inheritance diagram of pymlbenchmark.benchmark.profiler_class

Short summary

module pymlbenchmark.benchmark.profiler_class

Implements a benchmark about performance.

source on GitHub

Classes

class

truncated documentation

ProfilerCall

Runs a profiler on a specific call. It can use either pyinstrument, either cProfile. The first module …

Methods

method

truncated documentation

__init__

__iter__

Iterates on stored profiled. Returns a couple (profile, configuration).

__len__

Returns the number of stored profiles.

match

Tells if the profiler should be run on this set of parameters.

profile

Profiles function fct, calls it repeat times.

to_txt

Saves all profiles into one file.

Documentation

Implements a benchmark about performance.

source on GitHub

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.

source on GitHub

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

source on GitHub

__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

source on GitHub

__iter__()

Iterates on stored profiled. Returns a couple (profile, configuration).

source on GitHub

__len__()

Returns the number of stored profiles.

source on GitHub

match(**kwargs)

Tells if the profiler should be run on this set of parameters.

Parameters:

kwargs – dictionary of parameters

Returns:

boolean

source on GitHub

profile(fct, **kwargs)

Profiles function fct, calls it repeat times.

Parameters:
  • fct – function to profile (no argument)

  • kwargs – stores additional information about the profiling

source on GitHub

to_txt(filename)

Saves all profiles into one file.

Parameters:

filename – filename where to save the profiles, can be a stream

source on GitHub