feat(miner): scale displayed hashrate units dynamically
This commit is contained in:
@@ -53,6 +53,7 @@ static void emit_eventf(int fd, const char *fmt, ...) {
|
||||
|
||||
static void status_callback(long long attempts, double hashrate_hz, void *ctx_ptr) {
|
||||
StatusCtx *ctx = (StatusCtx *)ctx_ptr;
|
||||
char rate_buf[32];
|
||||
|
||||
if (ctx->event_fd >= 0) {
|
||||
emit_eventf(ctx->event_fd, "status %d %.6f %lld\n", ctx->worker_idx, hashrate_hz / 1000.0, attempts);
|
||||
@@ -60,7 +61,8 @@ static void status_callback(long long attempts, double hashrate_hz, void *ctx_pt
|
||||
}
|
||||
|
||||
if (ctx->single_mode) {
|
||||
printf("\r[main] hashrate: %.2f kH/s | attempts: %lld", hashrate_hz / 1000.0, attempts);
|
||||
format_hashrate_hz(hashrate_hz, rate_buf, sizeof(rate_buf));
|
||||
printf("\r[main] hashrate: %s | attempts: %lld", rate_buf, attempts);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user