pytmosph3r.util.profiling

Module Contents

profiler(filename: pathlib.Path | None = None) cProfile.Profile[source]

Profile some part of the code using a context block.

with profiler() as pr:
    m = np.random.random((1000,1000)) ** 2

# After the context block, the profile can be accessed.
print(pr.stats)
Parameters:

filename (Optional[Path]) – name of the file where to save the profile

Returns:

Return the profile of the code previously executed.