Adjust column width of A/R/HW to be the maximum of any device and align them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
diff --git a/Makefile.am b/Makefile.am
index 0a174ad..4a6b25e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
diff --git a/configure.ac b/configure.ac
index f5583c0..ec6a914 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
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)"
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"
diff --git a/main.c b/main.c
index cded16d..a18355d 100644
--- a/main.c
+++ b/main.c
@@ -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)
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)
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:
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);