Browse Source

Allow to retrieve benchmark results with a time-limit

sample command line :
ccminer -a x11 -d 0 --benchmark --time-limit 30 2>result.txt
2upstream
Tanguy Pruvot 10 years ago
parent
commit
809cd3dc42
  1. 13
      ccminer.cpp
  2. 4
      util.cpp

13
ccminer.cpp

@ -1491,7 +1491,15 @@ static void *miner_thread(void *userdata) @@ -1491,7 +1491,15 @@ static void *miner_thread(void *userdata)
if (remain < 0) {
app_exit_code = EXIT_CODE_TIME_LIMIT;
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();
break;
}
@ -2909,7 +2917,8 @@ int main(int argc, char *argv[]) @@ -2909,7 +2917,8 @@ int main(int argc, char *argv[])
/* main loop - simply wait for workio thread to exit */
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);

4
util.cpp

@ -139,8 +139,8 @@ void applog(int prio, const char *fmt, ...) @@ -139,8 +139,8 @@ void applog(int prio, const char *fmt, ...)
use_colors ? CL_N : ""
);
pthread_mutex_lock(&applog_lock);
vfprintf(stderr, f, ap); /* atomic write to stderr */
fflush(stderr);
vfprintf(stdout, f, ap); /* atomic write to stdout */
fflush(stdout);
pthread_mutex_unlock(&applog_lock);
}
va_end(ap);

Loading…
Cancel
Save