LeanProfiler

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

enabled

record spans and export reports

tracePath

Trace Event JSON destination

summaryPath

strict summary JSON destination

eventLimit

maximum retained span count, or no limit

processName

process-track label shown by Perfetto

The environment entry point reads these variables:

Variable

Setting

LEAN_PROFILE

enable the session unless set to an empty or false-like value

LEAN_PROFILE_OUT

trace path

LEAN_PROFILE_SUMMARY_OUT

summary path

LEAN_PROFILE_MAX_EVENTS

retained event limit

LEAN_PROFILE_PROCESS_NAME

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