Skip to content

Show a tiny share as <0.1% in spanflame top - #3

Merged
Gulliby merged 1 commit into
mainfrom
feature/tiny-share-marker
Oct 27, 2026
Merged

Gulliby merged 1 commit into
mainfrom
feature/tiny-share-marker

Conversation

@Gulliby

@Gulliby Gulliby commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Requested by gulliby

Before

spanflame top printed the SHARE column in tenths of a percent, rounded half up. A name with some self time but less than 0.05% of the total showed 0.0%, exactly like a name with no self time at all, so a reader could not tell a hot-but-tiny name from an idle one.

After

A name with self time whose rounded share would be 0.0 now shows <0.1%. A name with no self time still shows 0.0%, a total of zero still shows 0.0%, and every other share keeps its one decimal (exactly 0.05% still rounds up to 0.1%). The column width follows the widest cell as before.

   SELF  COUNT  SHARE  NAME
99901us      1  99.9%  job
   50us      1   0.1%  edge
   49us      1  <0.1%  under

How

  • src/top.ts: one early return in formatShare for a zero-rounded share of a name that has self time.
  • tests/top-share.test.ts: 4 new tests with literal examples (184 tests before, 188 after; no existing test changes).
  • README.md: one paragraph and its example after the top example.

bun test, bun run typecheck and bun run lint pass.

@Gulliby Gulliby self-assigned this Oct 27, 2026
@Gulliby
Gulliby merged commit 82165af into main Oct 27, 2026
6 checks passed
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