@ -154,11 +154,12 @@ static struct timeval total_tv_start, total_tv_end;
static int accepted , rejected ;
static int accepted , rejected ;
int hw_errors ;
int hw_errors ;
static int total_queued ;
static int total_queued ;
static unsigned int getwork_requested = 0 ;
static void applog_and_exit ( const char * fmt , . . . )
static void applog_and_exit ( const char * fmt , . . . )
{
{
va_list ap ;
va_list ap ;
va_start ( ap , fmt ) ;
va_start ( ap , fmt ) ;
vapplog ( LOG_ERR , fmt , ap ) ;
vapplog ( LOG_ERR , fmt , ap ) ;
va_end ( ap ) ;
va_end ( ap ) ;
@ -484,6 +485,7 @@ static bool submit_upstream_work(const struct work *work)
bool rc = false ;
bool rc = false ;
struct cgpu_info * cgpu = thr_info [ work - > thr_id ] . cgpu ;
struct cgpu_info * cgpu = thr_info [ work - > thr_id ] . cgpu ;
CURL * curl = curl_easy_init ( ) ;
CURL * curl = curl_easy_init ( ) ;
double utility , efficiency ;
if ( unlikely ( ! curl ) ) {
if ( unlikely ( ! curl ) ) {
applog ( LOG_ERR , " CURL initialisation failed " ) ;
applog ( LOG_ERR , " CURL initialisation failed " ) ;
@ -530,13 +532,19 @@ static bool submit_upstream_work(const struct work *work)
applog ( LOG_DEBUG , " PROOF OF WORK RESULT: false (booooo) " ) ;
applog ( LOG_DEBUG , " PROOF OF WORK RESULT: false (booooo) " ) ;
printf ( " [Rejected] " ) ;
printf ( " [Rejected] " ) ;
}
}
utility = accepted / ( total_secs ? total_secs : 1 ) * 60 ;
efficiency = getwork_requested ? cgpu - > accepted * 100.0 / getwork_requested : 0.0 ;
if ( ! opt_quiet ) {
if ( ! opt_quiet ) {
printf ( " [%sPU: %d] [Rate: %.2f Mhash/s] [Accepted: %d Rejected: %d HW errors: %d] \n " ,
printf ( " [%sPU: %d] [Rate: %.2f Mhash/s] [Requested: %d Accepted: %d Rejected: %d HW errors: %d Efficiency: %.3f%% Utility: %.2f/m] \n " ,
cgpu - > is_gpu ? " G " : " C " , cgpu - > cpu_gpu , cgpu - > total_mhashes / total_secs ,
cgpu - > is_gpu ? " G " : " C " , cgpu - > cpu_gpu , cgpu - > total_mhashes / total_secs ,
cgpu - > accepted , cgpu - > rejected , cgpu - > hw_errors ) ;
getwork_requested , cgpu - > accepted , cgpu - > rejected , cgpu - > hw_errors ,
efficiency , utility ) ;
}
}
applog ( LOG_INFO , " %sPU: %d Accepted: %d Rejected: %d HW errors: %d " ,
applog ( LOG_INFO , " %sPU: %d Requested: %d Accepted: %d Rejected: %d HW errors: %d efficiency: %.3f%% utility: %.2f/m " ,
cgpu - > is_gpu ? " G " : " C " , cgpu - > cpu_gpu , cgpu - > accepted , cgpu - > rejected , cgpu - > hw_errors ) ;
cgpu - > is_gpu ? " G " : " C " , cgpu - > cpu_gpu , getwork_requested , cgpu - > accepted , cgpu - > rejected , cgpu - > hw_errors , efficiency , utility
) ;
json_decref ( val ) ;
json_decref ( val ) ;
@ -757,6 +765,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
struct timeval temp_tv_end , total_diff ;
struct timeval temp_tv_end , total_diff ;
double khashes , secs ;
double khashes , secs ;
double local_secs ;
double local_secs ;
double utility , efficiency = 0.0 ;
static double local_mhashes_done = 0 ;
static double local_mhashes_done = 0 ;
static double rolling_local = 0 ;
static double rolling_local = 0 ;
double local_mhashes = ( double ) hashes_done / 1000000.0 ;
double local_mhashes = ( double ) hashes_done / 1000000.0 ;
@ -798,13 +807,18 @@ static void hashmeter(int thr_id, struct timeval *diff,
timeval_subtract ( & total_diff , & total_tv_end , & total_tv_start ) ;
timeval_subtract ( & total_diff , & total_tv_end , & total_tv_start ) ;
total_secs = ( double ) total_diff . tv_sec +
total_secs = ( double ) total_diff . tv_sec +
( ( double ) total_diff . tv_usec / 1000000.0 ) ;
( ( double ) total_diff . tv_usec / 1000000.0 ) ;
printf ( " [Rate (%ds): %.2f (avg): %.2f Mhash/s] [Accepted: %d Rejected: %d HW errors: %d] \r " ,
opt_log_interval , rolling_local / local_secs , total_mhashes_done / total_secs ,
utility = accepted / ( total_secs ? total_secs : 1 ) * 60 ;
accepted , rejected , hw_errors ) ;
efficiency = getwork_requested ? accepted * 100.0 / getwork_requested : 0.0 ;
printf ( " [Rate (%ds): %.2f (avg): %.2f Mhash/s] [Requested: %d Accepted: %d Rejected: %d HW errors: %d Efficiency: %.2f%% Utility: %.2f/m] \r " ,
opt_log_interval , rolling_local / local_secs , total_mhashes_done / total_secs ,
getwork_requested , accepted , rejected , hw_errors , efficiency , utility ) ;
fflush ( stdout ) ;
fflush ( stdout ) ;
applog ( LOG_INFO , " [Rate (%ds): %.2f (avg): %.2f Mhash/s] [Accepted: %d Rejected: %d HW errors: %d] " ,
applog ( LOG_INFO , " [Rate (%ds): %.2f (avg): %.2f Mhash/s] [Requested: %d Accepted: %d Rejected: %d HW errors: %d Efficiency: %.2f%% Utility: %.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 ,
accepted , rejected , hw_errors ) ;
getwork_requested , accepted , rejected , hw_errors , efficiency , utility ) ;
local_mhashes_done = 0 ;
local_mhashes_done = 0 ;
out_unlock :
out_unlock :
pthread_mutex_unlock ( & hash_lock ) ;
pthread_mutex_unlock ( & hash_lock ) ;
@ -1275,6 +1289,8 @@ static void *gpuminer_thread(void *userdata)
work - > thr_id = thr_id ;
work - > thr_id = thr_id ;
requested = false ;
requested = false ;
getwork_requested + + ;
precalc_hash ( & work - > blk , ( uint32_t * ) ( work - > midstate ) , ( uint32_t * ) ( work - > data + 64 ) ) ;
precalc_hash ( & work - > blk , ( uint32_t * ) ( work - > midstate ) , ( uint32_t * ) ( work - > data + 64 ) ) ;
work - > blk . nonce = 0 ;
work - > blk . nonce = 0 ;
work_restart [ thr_id ] . restart = 0 ;
work_restart [ thr_id ] . restart = 0 ;