Startup Profiling โ
Startup profiling helps diagnose slow CodeBuddy startup. With --startup-prof-md, CodeBuddy generates Markdown and JSON reports when startup is ready.
Usage โ
Place diagnostic options before other arguments:
sh
codebuddy --startup-prof-mdYou can also run a one-off task:
sh
codebuddy --startup-prof-md -p "say hi"To choose the report directory:
sh
codebuddy --startup-prof-md --startup-prof-dir ./profiles| Option | Description |
|---|---|
--startup-prof | Generate a JSON report only |
--startup-prof-md | Generate both Markdown and JSON reports |
--startup-prof-dir <directory> | Choose the report directory; defaults to the current working directory |
--startup-prof-name <name> | Choose the report filename; extensions are added automatically and existing files are not overwritten |
Usually, --startup-prof-md is sufficient. The report is generated automatically when the interactive interface is ready, and the current session remains usable. The report location is written to stderr without changing the existing stdout format.
Report Contents โ
The report includes:
- Runtime environment and version summary
- Total startup duration and key milestones
- Slow phases and the complete timeline
- Resource usage when startup completes
Profiling does not proactively record prompts, request bodies, credentials, the full environment, or configuration contents. Some phases may run concurrently or overlap, so do not add phase durations together as the total startup time.
Collection Boundaries and Comparison โ
CodeBuddy selects the startup boundary automatically: one-off tasks stop before the first request is sent, interactive mode stops when the interface is ready, and service mode stops when the service is available.
If the process exits normally before startup completes, a partial report may still be generated. Forced termination or a runtime crash cannot guarantee report generation. If startup does not complete within 60 seconds, the current report is generated and the process continues running.
When comparing results, keep the environment, version, mode, arguments, and configuration consistent, and collect multiple cold-start and warm-start samples. Profiling runs only when explicitly enabled, does not upload data, and does not alter the normal startup flow.