Skip to content

docs: add --cpu-prof-interval to the CPU profiling options - #44079

Open
gesposito wants to merge 1 commit into
oven-sh:mainfrom
gesposito:claude/docs-cpu-prof-interval
Open

gesposito wants to merge 1 commit into
oven-sh:mainfrom
gesposito:claude/docs-cpu-prof-interval

Conversation

@gesposito

Copy link
Copy Markdown

What does this PR do?

Part of #44077. The profiler fix for that issue is in #44078. This PR covers only the docs gap that the issue notes at the end.

bun --help lists --cpu-prof-interval ("Specify the sampling interval in microseconds for CPU profiling (default: 1000)"). The options table under "CPU profiling" in docs/project/benchmarking.mdx does not list it. The heap profiling table on the same page lists --heap-prof-interval.

This PR adds:

  • a table row for --cpu-prof-interval <microseconds>: "Set sampling interval (default: 1000)"
  • an example to the Options code block: bun --cpu-prof --cpu-prof-interval 500 script.js

bun run prettier realigned the table, so the other rows change only in padding.

The CLI reference page docs/snippets/cli/run.mdx is not changed here, because the open PR #43044 adds --cpu-prof-interval to it.

How did you verify your code works?

Docs only, so there is no test change. I checked the page against --help and the implementation, and ran each example as written. The runs used a debug build of main f063852e5, 1.4.3-canary.1+f063852e5 and 1.4.2+744846f84 on macOS arm64.

  • Default. The docs, --help and the code all give 1000: CpuProf::default() in src/options_types/context.rs sets interval: 1000, src/runtime/cli/Arguments.rs falls back to 1000 when the value does not parse, and s_samplingInterval in BunCPUProfiler.cpp starts at 1000.

  • Examples. All three commands in the Options block exit 0, and each writes one .cpuprofile.

  • Behavior, 200 ms busy loop, --cpu-prof. Samples in every run I logged, in run order:

    Build Runs no flag --cpu-prof-interval 1000 --cpu-prof-interval 500
    1.4.2 3 158, 156, 150 159, 155, 147 308, 305, 268
    canary 4 153, 157, 152, 157 148, 159, 157, 156 206, 307, 305, 303
    debug build of main 2 153, 158 153, 152 307, 253

    At 500, six of the nine runs took 303 to 308 samples. The other three took 268, 206 and 253, and their median gap between samples was 0.73 to 0.84 ms, against 0.64 to 0.66 ms in the six. Every run took more samples at 500 than with no flag, 1.35 to 2.01 times as many. The logged load averages around these runs were 6 to 12.

    --cpu-prof-md --cpu-prof-interval 500 shows 500us in the header's Interval column.

  • Formatting. bun run prettier changed only this file.

  • Rendering. Bun.markdown.html renders the section's table with five rows. I did not run a Mintlify preview.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: oven-sh/bun/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0a1287ed-3772-4929-a9a2-c0ebe6f403c4

📥 Commits

Reviewing files that changed from the base of the PR and between 36cd151 and 32ef0c1.

📒 Files selected for processing (1)
  • docs/project/benchmarking.mdx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The CPU profiler options table now includes --cpu-prof-interval <microseconds> and documents its default value as 1000.

Changes

CPU profiler documentation

Layer / File(s) Summary
Document the CPU profiler interval option
docs/project/benchmarking.mdx
The options table adds --cpu-prof-interval <microseconds> with a documented default of 1000. Existing command examples remain.

Suggested reviewers: robobun

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 32ef0

The documented default and example match the profiler behavior; no material merge-readiness risk remains.

Architecture Summary

Architecture risk: 🔵 Low · up to 32ef0

The change affects 1 system.

Changed systems: docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — docs (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in docs/project/benchmarking.mdx: The CPU profiler options table adds --cpu-prof-interval <microseconds> with a documented default of 1000; the prior table listed only the other four CPU profiling flags.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main documentation change: adding --cpu-prof-interval to the CPU profiling options.
Description check ✅ Passed The description includes both required sections. It explains the documentation change and provides detailed verification steps, results, and scope limitations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

`bun --help` lists `--cpu-prof-interval` (sampling interval in
microseconds, default 1000), but the flag table in
docs/project/benchmarking.mdx did not. Add a row and an example.
Prettier realigned the other rows of the table.
@gesposito
gesposito force-pushed the claude/docs-cpu-prof-interval branch from 32ef0c1 to 458467d Compare September 26, 2026 23:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant