1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Code cleanup after last two commits.

Display reject percentage in a fixed-width field.
This commit is contained in:
Noel Maersk 2014-01-11 17:57:50 +02:00
parent d53b329f18
commit b4e36e69e8

View File

@ -2053,9 +2053,10 @@ static int dev_width;
static void curses_print_devstatus(struct cgpu_info *cgpu, int count) static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
{ {
static int dawidth = 1, drwidth = 1, hwwidth = 1, wuwidth = 1; static int drwidth = 5, hwwidth = 1, wuwidth = 1;
char logline[256]; char logline[256];
char displayed_hashes[16], displayed_rolling[16]; char displayed_hashes[16], displayed_rolling[16];
float reject_pct = 0.0;
uint64_t dh64, dr64; uint64_t dh64, dr64;
struct timeval now; struct timeval now;
double dev_runtime, wu; double dev_runtime, wu;
@ -2104,15 +2105,12 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
else else
cg_wprintw(statuswin, "%6s", displayed_rolling); cg_wprintw(statuswin, "%6s", displayed_rolling);
adj_fwidth(cgpu->diff_accepted, &dawidth);
adj_fwidth(cgpu->diff_rejected, &drwidth);
adj_width(cgpu->hw_errors, &hwwidth);
adj_width(wu, &wuwidth);
float reject_pct = 0.0;
if ((cgpu->diff_accepted + cgpu->diff_rejected) > 0) if ((cgpu->diff_accepted + cgpu->diff_rejected) > 0)
reject_pct = (cgpu->diff_rejected / (cgpu->diff_accepted + cgpu->diff_rejected)) * 100; reject_pct = (cgpu->diff_rejected / (cgpu->diff_accepted + cgpu->diff_rejected)) * 100;
adj_width(cgpu->hw_errors, &hwwidth);
adj_width(wu, &wuwidth);
cg_wprintw(statuswin, "/%6sh/s | R:%*.1f%% HW:%*d WU:%*.1f/m", cg_wprintw(statuswin, "/%6sh/s | R:%*.1f%% HW:%*d WU:%*.1f/m",
displayed_hashes, displayed_hashes,
drwidth, reject_pct, drwidth, reject_pct,