Examples and workflows

Examples and workflows#

The repository includes small scripts for specific profiling tasks and a repeatable AI optimization workflow.

Profiling examples#

Run an example with:

python examples/<script>.py

For large or high-frequency workloads, aggregation mode stores call counts, inclusive totals, minimums, maximums, and exclusive totals while keeping the profile small:

with ProfileManager.session(
    aggregation_mode=True,
    return_results=True,
) as run:
    with ProfileManager.profile_region("solve"):
        solve()

run.results.print_summary(title="Aggregate profile")

See ex_aggregation.py for a complete runnable example. Individual events and timeline plots are not available in this mode.

AI optimization workflow#

The agent workflow example demonstrates measure → edit → re-measure → correctness-check using the CLI or MCP tools. The runnable repository workload is configured in benchmarks/sensor.toml.

See AGENTS.md for the instructions used by Codex and other coding agents.