bloc.testing.profile#

Profile a STONE model run: where the wall time goes, and who builds Solutions.

Usage (from the repo root, in the bloc env):

python -m bloc.testing.profile models/tube_furnace/tube_furnace.yaml
python -m bloc.testing.profile <model>.yaml --calc-note      # full note, all scenarios
python -m bloc.testing.profile <model>.yaml --out run.prof   # then: snakeviz run.prof

Prints the wall time, the callers of every mechanism-loading function (ct.Solution file parses, bloc.io.mechanisms.new_solution(), build_lite_solution(), Boulder’s create_solution) – on a large mechanism these are the first thing to check, one file parse being seconds – and the usual cProfile tables restricted to bloc / boulder frames so the model’s own code stands out.

Plain cProfile: no dependency, and C-level work (CVODE, Cantera) shows up as the tottime of the Python function that called it, which is exactly where a chemistry solve should appear.

Functions#

profile(yaml_path, *[, calc_note, top, out])

Run yaml_path under cProfile and print the report described in the module docstring.

main([argv])

Command-line entry point.

Module Contents#

bloc.testing.profile.profile(yaml_path, *, calc_note=False, top=25, out=None)#

Run yaml_path under cProfile and print the report described in the module docstring.

bloc.testing.profile.main(argv=None)#

Command-line entry point.