Skip to content

Commit

Permalink
Move driver statline padding to cgminer.c, expanding width of maximum…
Browse files Browse the repository at this point in the history
… displayable statistics and window width to add more info.
  • Loading branch information
ckolivas committed Feb 18, 2014
1 parent 648be96 commit 257fe00
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 29 deletions.
17 changes: 11 additions & 6 deletions cgminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ static void curses_print_status(void)
wattron(statuswin, A_BOLD);
cg_mvwprintw(statuswin, 0, 0, " " PACKAGE " version " VERSION " - Started: %s", datestamp);
wattroff(statuswin, A_BOLD);
mvwhline(statuswin, 1, 0, '-', 90);
mvwhline(statuswin, 1, 0, '-', 98);
cg_mvwprintw(statuswin, 2, 0, " %s", statusline);
wclrtoeol(statuswin);
cg_mvwprintw(statuswin, 3, 0, " ST: %d SS: %d NB: %d LW: %d GF: %d RF: %d",
Expand All @@ -2320,8 +2320,8 @@ static void curses_print_status(void)
wclrtoeol(statuswin);
cg_mvwprintw(statuswin, 5, 0, " Block: %s... Diff:%s Started: %s Best share: %s ",
prev_block, block_diff, blocktime, best_share);
mvwhline(statuswin, 6, 0, '-', 90);
mvwhline(statuswin, statusy - 1, 0, '-', 90);
mvwhline(statuswin, 6, 0, '-', 98);
mvwhline(statuswin, statusy - 1, 0, '-', 98);
#ifdef USE_USBUTILS
cg_mvwprintw(statuswin, devcursor - 1, 1, "[U]SB device management [P]ool management [S]ettings [D]isplay options [Q]uit");
#else
Expand All @@ -2342,6 +2342,8 @@ static void adj_fwidth(float var, int *length)
}

static int dev_width;
#define STATBEFORELEN 23
const char blanks[] = " ";

static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
{
Expand All @@ -2351,6 +2353,7 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
uint64_t dh64, dr64;
struct timeval now;
double dev_runtime, wu;
unsigned int devstatlen;

if (opt_compact)
return;
Expand Down Expand Up @@ -2378,7 +2381,10 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int devno, int count)
cg_wprintw(statuswin, " %03d: %s %*d: ", devno, cgpu->drv->name, dev_width, cgpu->device_id);
logline[0] = '\0';
cgpu->drv->get_statline_before(logline, sizeof(logline), cgpu);
cg_wprintw(statuswin, "%s", logline);
devstatlen = strlen(logline);
if (devstatlen < STATBEFORELEN)
strncat(logline, blanks, STATBEFORELEN - devstatlen);
cg_wprintw(statuswin, "%s | ", logline);

dh64 = (double)cgpu->total_mhashes / dev_runtime * 1000000ull;
dr64 = (double)cgpu->rolling * 1000000ull;
Expand Down Expand Up @@ -8048,9 +8054,8 @@ static void noop_reinit_device(struct cgpu_info __maybe_unused *cgpu)
{
}

void blank_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info __maybe_unused *cgpu)
void blank_get_statline_before(char __maybe_unused *buf,size_t __maybe_unused bufsiz, struct cgpu_info __maybe_unused *cgpu)
{
tailsprintf(buf, bufsiz, " | ");
}

static void noop_get_statline(char __maybe_unused *buf, size_t __maybe_unused bufsiz, struct cgpu_info __maybe_unused *cgpu)
Expand Down
4 changes: 2 additions & 2 deletions driver-avalon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,15 +1479,15 @@ static void get_avalon_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
temp = 99;
if (temp < 0)
temp = 0;
tailsprintf(buf, bufsiz, "%2dC %3d %4dmV | ", temp, info->frequency, info->core_voltage);
tailsprintf(buf, bufsiz, "%2dC %3d %4dmV", temp, info->frequency, info->core_voltage);
} else {
/* Find the lowest fan speed of the ASIC cooling fans. */
if (info->fan1 >= 0 && info->fan1 < lowfan)
lowfan = info->fan1;
if (info->fan2 >= 0 && info->fan2 < lowfan)
lowfan = info->fan2;

tailsprintf(buf, bufsiz, "%2dC/%3dC %04dR | ", info->temp0, info->temp2, lowfan);
tailsprintf(buf, bufsiz, "%2dC/%3dC %04dR", info->temp0, info->temp2, lowfan);
}
}

Expand Down
4 changes: 2 additions & 2 deletions driver-bab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2987,13 +2987,13 @@ static void bab_get_statline_before(char *buf, size_t bufsiz, struct cgpu_info *
K_RUNLOCK(babinfo->nfree_list);
}

tailsprintf(buf, bufsiz, "%d.%02d.%03d D:%03d | ",
tailsprintf(buf, bufsiz, "%d.%02d.%03d D:%03d",
babinfo->banks,
babinfo->boards,
babinfo->chips,
dead);
#else
tailsprintf(buf, bufsiz, "B:%d B:%02d C:%03d | ",
tailsprintf(buf, bufsiz, "B:%d B:%02d C:%03d",
babinfo->banks,
babinfo->boards,
babinfo->chips);
Expand Down
2 changes: 1 addition & 1 deletion driver-bflsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ static void get_bflsc_statline_before(char *buf, size_t bufsiz, struct cgpu_info
}
rd_unlock(&(sc_info->stat_lock));

tailsprintf(buf, bufsiz, " max%3.0fC %4.2fV | ", temp, vcc2);
tailsprintf(buf, bufsiz, "max%3.0fC %4.2fV", temp, vcc2);
}

static void flush_one_dev(struct cgpu_info *bflsc, int dev)
Expand Down
6 changes: 1 addition & 5 deletions driver-bitforce.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,7 @@ static void get_bitforce_statline_before(char *buf, size_t bufsiz, struct cgpu_i
float gt = bitforce->temp;

if (gt > 0)
tailsprintf(buf, bufsiz, "%5.1fC ", gt);
else
tailsprintf(buf, bufsiz, " ");

tailsprintf(buf, bufsiz, " | ");
tailsprintf(buf, bufsiz, "%5.1fC", gt);
}

static bool bitforce_thread_prepare(__maybe_unused struct thr_info *thr)
Expand Down
3 changes: 1 addition & 2 deletions driver-bitfury.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,11 +1114,10 @@ static void bitfury_get_statline_before(char *buf, size_t bufsiz, struct cgpu_in

switch(info->ident) {
case IDENT_BXF:
tailsprintf(buf, bufsiz, "%5.1fC | ", cgpu->temp);
tailsprintf(buf, bufsiz, "%5.1fC", cgpu->temp);
break;
case IDENT_BF1:
default:
tailsprintf(buf, bufsiz, " | ");
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion driver-cointerra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ static void cta_statline_before(char *buf, size_t bufsiz, struct cgpu_info *coin
}
max_volt /= 100;

tailsprintf(buf, bufsiz, "%3d %3.1fC %2.1fV | ", freq, cointerra->temp, max_volt);
tailsprintf(buf, bufsiz, "%3d %3.1fC %2.1fV", freq, cointerra->temp, max_volt);
}

struct device_drv cointerra_drv = {
Expand Down
2 changes: 0 additions & 2 deletions driver-drillbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,6 @@ static void drillbit_get_statline_before(char *buf, size_t bufsiz, struct cgpu_i
// Space out to the same width as if there was a temp field in place
tailsprintf(buf, bufsiz, " %*s", space, "");
}

tailsprintf(buf, bufsiz, " | ");
}


Expand Down
2 changes: 1 addition & 1 deletion driver-hashfast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ static void hfa_statline_before(char *buf, size_t bufsiz, struct cgpu_info *hash
}
}

tailsprintf(buf, bufsiz, " max%3.0fC %3.2fV | ", hashfast->temp, max_volt);
tailsprintf(buf, bufsiz, "max%3.0fC %3.2fV", hashfast->temp, max_volt);
}

static void hfa_init(struct cgpu_info __maybe_unused *hashfast)
Expand Down
4 changes: 0 additions & 4 deletions driver-icarus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,10 +1513,6 @@ static void icarus_statline_before(char *buf, size_t bufsiz, struct cgpu_info *c

if (info->ident == IDENT_CMR2 && info->cmr2_speed > 0)
tailsprintf(buf, bufsiz, "%5.1fMhz", (float)(info->cmr2_speed) * ICARUS_CMR2_SPEED_FACTOR);
else
tailsprintf(buf, bufsiz, " ");

tailsprintf(buf, bufsiz, " | ");
}

static void icarus_shutdown(__maybe_unused struct thr_info *thr)
Expand Down
2 changes: 1 addition & 1 deletion driver-klondike.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ static void get_klondike_statline_before(char *buf, size_t siz, struct cgpu_info
if (strlen(tmp) < 4)
strcat(tmp, " ");

tailsprintf(buf, siz, "%3dMHz %2d%% %s| ", (int)clock, fan, tmp);
tailsprintf(buf, siz, "%3dMHz %2d%% %s", (int)clock, fan, tmp);
}

static struct api_data *klondike_api_stats(struct cgpu_info *klncgpu)
Expand Down
2 changes: 1 addition & 1 deletion driver-minion.c
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ static void minion_get_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
if (max_temp > 99)
max_temp = 99;

tailsprintf(buf, bufsiz, "max%2dC Ch:%2d.%d%*s| ", (int)max_temp,
tailsprintf(buf, bufsiz, "max%2dC Ch:%2d.%d%*s", (int)max_temp,
minioninfo->chips, (int)cores, sp, "");
}

Expand Down
2 changes: 1 addition & 1 deletion driver-modminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static bool modminer_fpga_init(struct thr_info *thr)

static void get_modminer_statline_before(char *buf, size_t bufsiz, struct cgpu_info *modminer)
{
tailsprintf(buf, bufsiz, " %s%.1fC %3uMHz | ",
tailsprintf(buf, bufsiz, "%s%.1fC %3uMHz",
(modminer->temp < 10) ? " " : "",
modminer->temp,
(unsigned int)(modminer->clock));
Expand Down

0 comments on commit 257fe00

Please sign in to comment.