fix(performance-monitor-plugin): 1ms-precise time display#269
Merged
V3RON merged 1 commit intoMay 14, 2026
Conversation
…splay formatDuration drops fake decimals for milliseconds — clock is 1ms accurate, so .toFixed(2) was fabricating precision. Durations >= 1s display 3 decimals (1.234s) to preserve the same 1ms precision in seconds. Non-zero sub-millisecond values render as "<1ms" to distinguish "fired but fast" from "not measured." Rounding now happens before unit selection, so 999.6ms displays as 1.000s rather than 1000ms. formatTime now produces a stable 24h HH:MM:SS.mmm format so the millisecond component is visible alongside HH:MM:SS in the Mark / Metric / Measure / Resource / ReactNativeMark details panels and on the session-started line. Inline formatTime duplicates in MarkDetails, MetricDetails, and SessionDuration are replaced with imports from utils so the new format propagates everywhere. SessionDuration keeps its own whole-second formatDuration for the always-ticking session-length display. ResourceDetails.formatPhase keeps its 0/undefined → "—" special case but routes non-zero values through formatDuration so resource timing phases honor the same precision rule. Adds vitest tests covering the boundary behaviors (zero, sub-1ms, ms rounding, ms/s switch at 1000, round-across-boundary at 999.6, ms padding, midnight, end-of-day).
V3RON
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
formatDurationno longer fakes precision: ms values round to integer (.toFixed(2)was fabricating 0.01ms detail the clock can't provide),>= 1svalues show 3 decimals (1.234s) for the same 1ms-precision invariant, and non-zero sub-1ms values display as<1msto distinguish "fired but fast" from "not measured." Rounding happens before the unit switch, so999.6msdisplays as1.000srather than1000ms.formatTimenow produces a stable 24hHH:MM:SS.mmmformat — the millisecond component is visible alongside HH:MM:SS on every "Recorded at" / "Started" / "Start Time" / "End Time" line across Mark / Metric / Measure / Resource / ReactNativeMark / SessionDuration.formatTimeduplicates inMarkDetails,MetricDetails, andSessionDurationreplaced with imports fromutils.ResourceDetails.formatPhasekeeps its0/undefined → "—"special case but routes non-zero values throughformatDurationso resource timing phases honor the same precision rule.SessionDurationkeeps its own whole-secondformatDurationfor the always-ticking session-length display.Test plan
pnpm --filter @rozenite/performance-monitor-plugin test— all 26 tests pass (10 newutils.test.ts+ 16 existing for serialize/derive-startup-phases).pnpm --filter @rozenite/performance-monitor-plugin typecheck— clean.pnpm --filter @rozenite/performance-monitor-plugin lint— clean.HH:MM:SS.mmm(24h, three-digit ms padding).1.234sstyle for ≥1s.performance.markthat fires near-instantly displays as<1ms, not0ms.