Allow to retrieve benchmark results with a time-limit
sample command line : ccminer -a x11 -d 0 --benchmark --time-limit 30 2>result.txt
This commit is contained in:
parent
4daaf1908d
commit
809cd3dc42
13
ccminer.cpp
13
ccminer.cpp
@ -1491,7 +1491,15 @@ static void *miner_thread(void *userdata)
|
|||||||
if (remain < 0) {
|
if (remain < 0) {
|
||||||
app_exit_code = EXIT_CODE_TIME_LIMIT;
|
app_exit_code = EXIT_CODE_TIME_LIMIT;
|
||||||
abort_flag = true;
|
abort_flag = true;
|
||||||
applog(LOG_NOTICE, "Mining timeout of %ds reached, exiting...", opt_time_limit);
|
if (opt_benchmark) {
|
||||||
|
char rate[32];
|
||||||
|
format_hashrate(global_hashrate, rate);
|
||||||
|
applog(LOG_NOTICE, "Benchmark: %s", rate);
|
||||||
|
usleep(200*1000);
|
||||||
|
fprintf(stderr, "%llu\n", (long long unsigned int) global_hashrate);
|
||||||
|
} else {
|
||||||
|
applog(LOG_NOTICE, "Mining timeout of %ds reached, exiting...", opt_time_limit);
|
||||||
|
}
|
||||||
workio_abort();
|
workio_abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2909,7 +2917,8 @@ int main(int argc, char *argv[])
|
|||||||
/* main loop - simply wait for workio thread to exit */
|
/* main loop - simply wait for workio thread to exit */
|
||||||
pthread_join(thr_info[work_thr_id].pth, NULL);
|
pthread_join(thr_info[work_thr_id].pth, NULL);
|
||||||
|
|
||||||
applog(LOG_INFO, "workio thread dead, exiting.");
|
if (opt_debug)
|
||||||
|
applog(LOG_DEBUG, "workio thread dead, exiting.");
|
||||||
|
|
||||||
proper_exit(EXIT_CODE_OK);
|
proper_exit(EXIT_CODE_OK);
|
||||||
|
|
||||||
|
4
util.cpp
4
util.cpp
@ -139,8 +139,8 @@ void applog(int prio, const char *fmt, ...)
|
|||||||
use_colors ? CL_N : ""
|
use_colors ? CL_N : ""
|
||||||
);
|
);
|
||||||
pthread_mutex_lock(&applog_lock);
|
pthread_mutex_lock(&applog_lock);
|
||||||
vfprintf(stderr, f, ap); /* atomic write to stderr */
|
vfprintf(stdout, f, ap); /* atomic write to stdout */
|
||||||
fflush(stderr);
|
fflush(stdout);
|
||||||
pthread_mutex_unlock(&applog_lock);
|
pthread_mutex_unlock(&applog_lock);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user