kempnerpulse.present.format¶
Display formatting, styling, and canonical→display unit conversion.
The Present layer renders ComputedRecord objects whose metric values are canonical:
ratios in [0, 1], throughputs in bytes/second, energy in joules, and so on.
Display, however, wants percents, GB/s, and watts. The converters here are the
single place that bridge the two: a presenter never multiplies by 100 inline,
it calls fraction_to_percent(). None (an unavailable reading) always
maps to None and renders as -- — never coerced to 0.
The fmt_* formatters and *_style colour helpers are ported verbatim from
the single-file implementation so the rendered output is byte-for-byte familiar.
Functions
A bytes/second throughput → GB/s (decimal, ÷1e9). |
|
|
Compact duration label that picks units to keep the number readable. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A |
|
Return the warning/critical temperature thresholds for a GPU model. |
|
A fixed- |
|
Cumulative millijoules → joules. |
|
Colour an NVLink value by % of its theoretical max (usage_style scale). |
|
|
|
A unicode-block sparkline of |
|
|
|
- kempnerpulse.present.format.get_temp_thresholds(model_name=None)[source]¶
Return the warning/critical temperature thresholds for a GPU model.
- kempnerpulse.present.format.fraction_to_percent(value)[source]¶
A
[0, 1]fraction → a[0, 100]percent, clamped defensively.
- kempnerpulse.present.format.bytes_per_second_to_gigabytes(value)[source]¶
A bytes/second throughput → GB/s (decimal, ÷1e9).
Applied to NVLink and PCIe alike. NVLink GB/s computed this way equals the legacy
MB/s ÷ 1e3figure, since the canonical NVLink rate is the legacy MB/s gauge × 1e6.
- kempnerpulse.present.format.millijoules_to_joules(value)[source]¶
Cumulative millijoules → joules. (Canonical energy is already joules.)
- kempnerpulse.present.format.fmt_duration(seconds, *, signed=False)[source]¶
Compact duration label that picks units to keep the number readable.
Used by the footer’s
poll=indicator (always positive) and by the line-plot x-axis tick labels (which passsigned=Truefor offsets like-50msrelative to “now”).Examples:
fmt_duration(1.0) -> "1s" fmt_duration(0.5) -> "500ms" fmt_duration(0.05) -> "50ms" fmt_duration(0.001) -> "1ms" fmt_duration(0.0) -> "0s" fmt_duration(-0.05, signed=True) -> "-50ms"
- kempnerpulse.present.format.nvlink_util_style(gbps, limit_gbps)[source]¶
Colour an NVLink value by % of its theoretical max (usage_style scale).