Browse Source

Adjust column width of A/R/HW to be the maximum of any device and align them.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
743d81b36b
  1. 4
      Makefile.am
  2. 4
      configure.ac
  3. 26
      main.c

4
Makefile.am

@ -31,7 +31,9 @@ cgminer_SOURCES = elist.h miner.h compat.h bench_block.h \ @@ -31,7 +31,9 @@ cgminer_SOURCES = elist.h miner.h compat.h bench_block.h \
sha2.c sha2.h api.c
cgminer_LDFLAGS = $(PTHREAD_FLAGS)
cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @OPENCL_LIBS@ @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ lib/libgnu.a ccan/libccan.a
cgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
@OPENCL_LIBS@ @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \
@MATH_LIBS@ lib/libgnu.a ccan/libccan.a
cgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @OPENCL_FLAGS@
if HAVE_x86_64

4
configure.ac

@ -65,6 +65,7 @@ PTHREAD_FLAGS="-lpthread" @@ -65,6 +65,7 @@ PTHREAD_FLAGS="-lpthread"
DLOPEN_FLAGS="-ldl"
OPENCL_LIBS="-lOpenCL"
WS2_LIBS=""
MATH_LIBS="-lm"
case $target in
x86_64-*)
@ -277,6 +278,7 @@ AC_SUBST(PTHREAD_LIBS) @@ -277,6 +278,7 @@ AC_SUBST(PTHREAD_LIBS)
AC_SUBST(NCURSES_LIBS)
AC_SUBST(PDCURSES_LIBS)
AC_SUBST(WS2_LIBS)
AC_SUBST(MATH_LIBS)
AC_CONFIG_FILES([
Makefile
@ -327,7 +329,7 @@ echo "Compilation............: make (or gmake)" @@ -327,7 +329,7 @@ echo "Compilation............: make (or gmake)"
echo " CPPFLAGS.............: $CPPFLAGS"
echo " CFLAGS...............: $CFLAGS"
echo " LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS"
echo " LDADD................: $DLOPEN_FLAGS"
echo " LDADD................: $DLOPEN_FLAGS $LIBCURL_LIBS $JANSSON_LIBS $PTHREAD_LIBS $OPENCL_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"

26
main.c

@ -2075,8 +2075,16 @@ static void curses_print_status(void) @@ -2075,8 +2075,16 @@ static void curses_print_status(void)
wnoutrefresh(statuswin);
}
static void adj_width(int var, int *length)
{
if ((int)(log10(var) + 1) > *length)
(*length)++;
}
static void curses_print_devstatus(int thr_id)
{
static int awidth = 1, rwidth = 1, hwwidth = 1;
if (thr_id >= 0 && thr_id < gpu_threads) {
int gpu = dev_from_id(thr_id);
struct cgpu_info *cgpu = &gpus[gpu];
@ -2111,9 +2119,14 @@ static void curses_print_devstatus(int thr_id) @@ -2111,9 +2119,14 @@ static void curses_print_devstatus(int thr_id)
wprintw(statuswin, "OFF ");
else
wprintw(statuswin, "%5.1f", cgpu->rolling);
wprintw(statuswin, "/%5.1fMh/s | A:%d R:%d HW:%d U:%.2f/m I:%d",
adj_width(cgpu->accepted, &awidth);
adj_width(cgpu->rejected, &rwidth);
adj_width(cgpu->hw_errors, &hwwidth);
wprintw(statuswin, "/%5.1fMh/s | A:%*d R:%*d HW:%*d U:%4.2f/m I:%2d",
cgpu->total_mhashes / total_secs,
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
awidth, cgpu->accepted,
rwidth, cgpu->rejected,
hwwidth, cgpu->hw_errors,
cgpu->utility, gpus[gpu].intensity);
wclrtoeol(statuswin);
} else if (thr_id >= gpu_threads) {
@ -2122,9 +2135,12 @@ static void curses_print_devstatus(int thr_id) @@ -2122,9 +2135,12 @@ static void curses_print_devstatus(int thr_id)
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
mvwprintw(statuswin, cpucursor + cpu, 0, " CPU %d: %5.2f/%5.2fMh/s | A:%d R:%d U:%.2f/m",
adj_width(cgpu->accepted, &awidth);
adj_width(cgpu->rejected, &rwidth);
mvwprintw(statuswin, cpucursor + cpu, 0, " CPU %d: %5.2f/%5.2fMh/s | A:%*d R:%*d U:%4.2f/m",
cpu, cgpu->rolling, cgpu->total_mhashes / total_secs,
cgpu->accepted, cgpu->rejected,
awidth, cgpu->accepted,
rwidth, cgpu->rejected,
cgpu->utility);
wclrtoeol(statuswin);
}
@ -3544,7 +3560,7 @@ retry: @@ -3544,7 +3560,7 @@ retry:
for (gpu = 0; gpu < nDevs; gpu++) {
struct cgpu_info *cgpu = &gpus[gpu];
wlog("GPU %d: %.1f / %.1f Mh/s | A:%d R:%d HW:%d U:%.2f/m I:%d\n",
wlog("GPU %d: %.1f / %.1f Mh/s | A:%d R:%d HW:%d U:%.2f/m I:2%d\n",
gpu, cgpu->rolling, cgpu->total_mhashes / total_secs,
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
cgpu->utility, cgpu->intensity);

Loading…
Cancel
Save