fix(mining): stamp hashrate history and label the chart by real time
The hashrate sparkline guessed the age of its oldest sample from the sample count, labelling the left edge "5m ago", "1m ago" or "start" regardless of how fast samples actually arrived. Solo and pool samples come in at different intervals, and a slow or stalled poll made those labels wrong. - Each hashrate sample now carries a wall-clock timestamp, kept in lockstep with the value as the history fills and rolls over, for both the solo and pool histories. - The chart's left-edge label is derived from the oldest sample's actual timestamp, falling back to "start" only when no stamp is available. Tests: a mining refresh records a timestamp per sample, and the timestamp history stays the same length as the value history once the history is capped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -146,7 +146,8 @@ struct MiningInfo {
|
||||
|
||||
// History for chart
|
||||
std::vector<double> hashrate_history; // Last N samples
|
||||
static constexpr int MAX_HISTORY = 300; // 5 minutes at 1s intervals
|
||||
std::vector<std::time_t> hashrate_history_t; // wall-clock stamp per sample (lockstep with hashrate_history)
|
||||
static constexpr int MAX_HISTORY = 300; // 5 minutes at ~1s intervals
|
||||
|
||||
// Recent daemon log lines for the mining log panel
|
||||
std::vector<std::string> log_lines;
|
||||
@@ -263,7 +264,8 @@ struct PoolMiningState {
|
||||
|
||||
// Hashrate history for chart (mirrors MiningInfo::hashrate_history)
|
||||
std::vector<double> hashrate_history;
|
||||
static constexpr int MAX_HISTORY = 60; // 5 minutes at ~5s intervals
|
||||
std::vector<std::time_t> hashrate_history_t; // wall-clock stamp per sample (lockstep with hashrate_history)
|
||||
static constexpr int MAX_HISTORY = 60; // ~2 min at the ~2s pool poll
|
||||
|
||||
// Recent log lines for the log panel
|
||||
std::vector<std::string> log_lines;
|
||||
|
||||
Reference in New Issue
Block a user