Browse Source

Tidy up display.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
02cd113cd9
  1. 37
      main.c

37
main.c

@ -537,12 +537,12 @@ static inline void __print_status(int thr_id)
{ {
wmove(statuswin, 0, 0); wmove(statuswin, 0, 0);
wattron(statuswin, A_BOLD); wattron(statuswin, A_BOLD);
wprintw(statuswin, PROGRAM_NAME " version " VERSION); wprintw(statuswin, " " PROGRAM_NAME " version " VERSION);
wattroff(statuswin, A_BOLD); wattroff(statuswin, A_BOLD);
wmove(statuswin, 1, 0); wmove(statuswin, 1, 0);
whline(statuswin, '-', 80); whline(statuswin, '-', 80);
wmove(statuswin, 2,0); wmove(statuswin, 2,0);
wprintw(statuswin, "Totals: %s", statusline); wprintw(statuswin, " %s", statusline);
wclrtoeol(statuswin); wclrtoeol(statuswin);
wmove(statuswin, 3, 0); wmove(statuswin, 3, 0);
whline(statuswin, '-', 80); whline(statuswin, '-', 80);
@ -554,7 +554,7 @@ static inline void __print_status(int thr_id)
struct cgpu_info *cgpu = &gpus[gpu]; struct cgpu_info *cgpu = &gpus[gpu];
wmove(statuswin, gpucursor + gpu, 0); wmove(statuswin, gpucursor + gpu, 0);
wprintw(statuswin, "GPU %d: [%.1f Mh/s] [Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m]", wprintw(statuswin, " GPU %d: [%.1f Mh/s] [Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m]",
gpu, cgpu->total_mhashes / total_secs, gpu, cgpu->total_mhashes / total_secs,
cgpu->getworks, cgpu->accepted, cgpu->rejected, cgpu->hw_errors, cgpu->getworks, cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
cgpu->efficiency, cgpu->utility); cgpu->efficiency, cgpu->utility);
@ -564,7 +564,7 @@ static inline void __print_status(int thr_id)
struct cgpu_info *cgpu = &cpus[cpu]; struct cgpu_info *cgpu = &cpus[cpu];
wmove(statuswin, cpucursor + cpu, 0); wmove(statuswin, cpucursor + cpu, 0);
wprintw(statuswin, "CPU %d: [%.1f Mh/s] [Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m]", wprintw(statuswin, " CPU %d: [%.1f Mh/s] [Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m]",
cpu, cgpu->total_mhashes / total_secs, cpu, cgpu->total_mhashes / total_secs,
cgpu->getworks, cgpu->accepted, cgpu->rejected, cgpu->hw_errors, cgpu->getworks, cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
cgpu->efficiency, cgpu->utility); cgpu->efficiency, cgpu->utility);
@ -602,7 +602,8 @@ static bool submit_upstream_work(const struct work *work)
json_t *val, *res; json_t *val, *res;
char s[345]; char s[345];
bool rc = false; bool rc = false;
struct cgpu_info *cgpu = thr_info[work->thr_id].cgpu; int thr_id = work->thr_id;
struct cgpu_info *cgpu = thr_info[thr_id].cgpu;
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
if (unlikely(!curl)) { if (unlikely(!curl)) {
@ -650,24 +651,24 @@ static bool submit_upstream_work(const struct work *work)
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)"); applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
if (!opt_quiet) if (!opt_quiet)
applog(LOG_WARNING, "Share accepted from %sPU %d", applog(LOG_WARNING, "Share accepted from %sPU %d thread %d",
cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu); cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id);
} else { } else {
cgpu->rejected++; cgpu->rejected++;
rejected++; rejected++;
if (opt_debug) if (opt_debug)
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)"); applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
if (!opt_quiet) if (!opt_quiet)
applog(LOG_WARNING, "Share rejected from %sPU %d", applog(LOG_WARNING, "Share rejected from %sPU %d thread %d",
cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu); cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, thr_id);
} }
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60; cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
cgpu->efficiency = cgpu->getworks ? cgpu->accepted * 100.0 / cgpu->getworks : 0.0; cgpu->efficiency = cgpu->getworks ? cgpu->accepted * 100.0 / cgpu->getworks : 0.0;
if (!opt_quiet) if (!opt_quiet)
print_status(work->thr_id); print_status(thr_id);
applog(LOG_INFO, "%sPU %d Requested:%d Accepted:%d Rejected:%d HW errors:%d Efficiency:%.0f%% Utility:%.2f/m", applog(LOG_INFO, "%sPU %d Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m",
cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, cgpu->getworks, cgpu->accepted, cgpu->is_gpu? "G" : "C", cgpu->cpu_gpu, cgpu->getworks, cgpu->accepted,
cgpu->rejected, cgpu->hw_errors, cgpu->efficiency, cgpu->utility); cgpu->rejected, cgpu->hw_errors, cgpu->efficiency, cgpu->utility);
@ -912,9 +913,9 @@ static void *stage_thread(void *userdata)
if (likely(strncmp(current_block, blank, 36))) { if (likely(strncmp(current_block, blank, 36))) {
if (unlikely(strncmp(hexstr, current_block, 36))) { if (unlikely(strncmp(hexstr, current_block, 36))) {
if (want_longpoll) if (want_longpoll)
applog(LOG_WARNING, "New block detected, possible missed longpoll, flushing work queue"); applog(LOG_WARNING, "New block detected on network before receiving longpoll, flushing work queue");
else else
applog(LOG_WARNING, "New block detected, flushing work queue"); applog(LOG_WARNING, "New block detected on network, flushing work queue");
/* As we can't flush the work from here, signal /* As we can't flush the work from here, signal
* the wakeup thread to restart all the * the wakeup thread to restart all the
* threads */ * threads */
@ -1028,13 +1029,11 @@ static void hashmeter(int thr_id, struct timeval *diff,
utility = accepted / ( total_secs ? total_secs : 1 ) * 60; utility = accepted / ( total_secs ? total_secs : 1 ) * 60;
efficiency = getwork_requested ? accepted * 100.0 / getwork_requested : 0.0; efficiency = getwork_requested ? accepted * 100.0 / getwork_requested : 0.0;
sprintf(statusline, "[(%ds):%.1f (avg):%.1f Mh/s] [Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m] ", sprintf(statusline, "[(%ds):%.1f (avg):%.1f Mh/s] [Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.2f/m]",
opt_log_interval, rolling_local / local_secs, total_mhashes_done / total_secs, opt_log_interval, rolling_local / local_secs, total_mhashes_done / total_secs,
getwork_requested, accepted, rejected, hw_errors, efficiency, utility); getwork_requested, accepted, rejected, hw_errors, efficiency, utility);
print_status(thr_id); print_status(thr_id);
applog(LOG_INFO, "[Rate (%ds):%.1f (avg):%.2f Mhash/s] [Requested:%d Accepted:%d Rejected:%d HW errors:%d Efficiency:%.0f%% Utility:%.2f/m]", applog(LOG_INFO, "%s", statusline);
opt_log_interval, rolling_local / local_secs, total_mhashes_done / total_secs,
getwork_requested, accepted, rejected, hw_errors, efficiency, utility);
local_mhashes_done = 0; local_mhashes_done = 0;
out_unlock: out_unlock:
@ -1705,10 +1704,10 @@ static void *longpoll_thread(void *userdata)
* sure it's only done once per new block */ * sure it's only done once per new block */
if (likely(!strncmp(longpoll_block, blank, 36) || if (likely(!strncmp(longpoll_block, blank, 36) ||
!strncmp(longpoll_block, current_block, 36))) { !strncmp(longpoll_block, current_block, 36))) {
applog(LOG_WARNING, "LONGPOLL detected new block, flushing work queue"); applog(LOG_WARNING, "LONGPOLL detected new block on network, flushing work queue");
restart_threads(true); restart_threads(true);
} else } else
applog(LOG_WARNING, "LONGPOLL received - new block detected and work flushed already"); applog(LOG_WARNING, "LONGPOLL received after new block already detected");
} else { } else {
/* Some pools regularly drop the longpoll request so /* Some pools regularly drop the longpoll request so
* only see this as longpoll failure if it happens * only see this as longpoll failure if it happens

Loading…
Cancel
Save