format

package
v0.0.0-...-9759625 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package format provides small formatting helpers shared across the UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n uint64) string

Bytes renders a byte count in binary units, e.g. "9.9 GiB".

func BytesCompact

func BytesCompact(n uint64) string

BytesCompact renders a byte count in binary units like Bytes, but drops the decimal once the value reaches 100 of its unit, so wide counts stay inside narrow table columns ("9.9 GiB", "128 GiB").

func CPUPct

func CPUPct(v float64) string

CPUPct renders a CPU percentage for a fixed 5-cell column: a busy multi-thread process can exceed 100 (up to cores×100), so values ≥100 drop the decimal and values ≥1000 clamp — the column can never push a table row out of alignment.

func Rate

func Rate(bps float64) string

Rate renders a bytes-per-second figure in decimal units, e.g. "12.4 MB/s".

func RateFixed

func RateFixed(w int, bps float64) string

RateFixed renders a rate right-padded to a fixed cell width, so live chip and head figures don't jitter sideways as their magnitude crosses unit boundaries ("986 B/s" ↔ "12.4 MB/s").

func Uptime

func Uptime(d time.Duration) string

Uptime renders a duration compactly, e.g. "3d 4h", "12m" or "45s".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL