1.1. Use an explicit configuration
Environment variables are convenient for commands and CI. A library or long-running application can pass the same settings directly:
def runProfiled (config : ProfilerConfig) : IO Unit :=
profile config "worker" do
span "work" runWork
The main configuration fields are:
Field | Meaning |
|---|---|
| record spans and export reports |
| Trace Event JSON destination |
| strict summary JSON destination |
| maximum retained span count, or no limit |
| process-track label shown by Perfetto |
The environment entry point reads these variables:
Variable | Setting |
|---|---|
| enable the session unless set to an empty or false-like value |
| trace path |
| summary path |
| retained event limit |
| Perfetto process label |
Keep explicit paths when saving several runs:
LEAN_PROFILE=1 \ LEAN_PROFILE_OUT=build/traces/baseline.json \ LEAN_PROFILE_SUMMARY_OUT=build/summaries/baseline.json \ LEAN_PROFILE_PROCESS_NAME="baseline worker" \ lake exe your_executable