mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1925] [CLOSED] Add optional GPU electricity cost display to Power card #3760
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3760
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1925
Author: @hash13
Created: 10/11/2026
Status: ❌ Closed
Base:
main← Head:feature/monitor-gpu-electricity-cost📝 Commits (2)
4b8ba58feat(monitor): add opt-in cumulative GPU energy tracking51134b6feat(monitor): show GPU electricity costs in Power card📊 Changes
3 files changed (+104 additions, -3 deletions)
View changed files
📝
serve/server.py(+3 -1)📝
serve/telemetry.py(+54 -1)📝
serve/web/app.js(+47 -1)📄 Description
Minimal version without electricity pricing: https://github.com/Niko1221/Strata/pull/1876
Add opt-in GPU energy and electricity cost monitoring to the Power card
Summary
This PR adds opt-in GPU energy monitoring and optional electricity cost calculations to the existing Power card, based on Strata v0.1.42.
The implementation reuses Strata's existing GPU telemetry, multi-GPU support, and Monitor refresh infrastructure. No additional services, dependencies, or persistent storage are required.
The changes are intentionally limited to cumulative GPU energy consumption and total electricity costs.
There is no request-level energy attribution, token cost calculation, or additional details dialog.
Screenshot
Configuration
GPU energy monitoring is enabled by adding an
electricityblock at the top level of the existing Strata JSON configuration.Energy monitoring only:
An empty object is sufficient to enable cumulative energy monitoring.
Energy monitoring with electricity costs:
price_per_kwh: Electricity price per kWh in the configured currency (e.g.0.32= €0.32/kWh).currency: Currency code used for displaying electricity costs (defaults toEUR).Without an
electricityblock, GPU energy monitoring is disabled and the existing Power card remains unchanged.Power Card
The existing Power card continues to display:
When electricity pricing is configured, the card uses a compact two-column layout:
Example:
The layout reuses the existing Speed card styling, without introducing additional CSS or increasing the card height.
When only energy monitoring is enabled, cumulative energy consumption is displayed alongside the existing power limit.
All values update automatically through the existing Monitor refresh cycle.
Value Formatting
Energy consumption:
Electricity costs:
The currency symbol is displayed in a smaller font, matching the existing unit styling.
Number formatting follows the browser's locale.
Energy Measurement
The implementation prefers NVIDIA's cumulative NVML hardware energy counter (
nvmlDeviceGetTotalEnergyConsumption).This provides accumulated energy directly in millijoules and avoids estimating consumption solely from periodically sampled power values.
If the hardware counter is unavailable, energy is estimated by integrating the existing GPU power samples over time.
For multi-GPU configurations, energy consumption is aggregated across the monitored GPUs.
Energy accumulation starts with the telemetry sampler and resets when Strata restarts.
Electricity costs are calculated from accumulated energy:
Cost = GPU energy (kWh) × configured price per kWh
No additional NVML reads are required for the cost calculation.
Measurements cover GPU energy only. CPU, RAM, motherboard, storage, fans, and PSU losses are not included.
Operating Modes
electricityblock"electricity": {}electricitywithprice_per_kwhConfiguration Examples
Energy monitoring only:
Energy monitoring with electricity costs:
price_per_kwh: Required to calculate electricity costs.currency: Optional, defaults toEUR. Explicit configuration is recommended.electricityblock, energy monitoring remains disabled.Electricity costs are calculated as:
Cost = accumulated GPU energy (kWh) × price_per_kwh
Scope
Cumulative energy consumption is exposed through the existing
/metricshardware data. The optional electricity price and currency are provided through the existing static telemetry data.Request-level energy attribution is deferred to a later PR, initially limited to serial requests to avoid double counting energy during overlapping requests.
Changed Files
The complete implementation, including the optional electricity cost extension, affects three files:
serve/telemetry.pyserve/server.pyelectricityconfiguration to telemetryserve/web/app.jsThe electricity cost extension itself only modifies
serve/telemetry.pyandserve/web/app.js.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
--pipeline-windows 3, opt-in): a host-side scheduler, a slot pool, per-stage undo, an 11-output draft chain #4771STRATA_SPLIT_COMMIT_ASYNC=1, opt-in) #4791STRATA_SELECT_LONG=1, opt-in, GP100 builds) #4793STRATA_PREFILL_PIPE_FLOOR, the smallest pipelined prompt chunk (default 512, as before) #4794