Free the scratchbuf memory allocated in scrypt and don't check if CPUs are sick since they can't be. Prepare for khash hash rates in display.
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
diff --git a/cgminer.c b/cgminer.c
index f5044e2..6002927 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3394,9 +3394,13 @@ static void hashmeter(int thr_id, struct timeval *diff,
double utility, efficiency = 0.0;
static double local_mhashes_done = 0;
static double rolling = 0;
- double local_mhashes = (double)hashes_done / 1000000.0;
+ double local_mhashes;
bool showlog = false;
+ if (opt_scrypt)
+ local_mhashes = (double)hashes_done / 1000.0;
+ else
+ local_mhashes = (double)hashes_done / 1000000.0;
/* Update the last time this thread reported in */
if (thr_id >= 0) {
gettimeofday(&thr_info[thr_id].last, NULL);
@@ -3472,9 +3476,9 @@ static void hashmeter(int thr_id, struct timeval *diff,
utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
- sprintf(statusline, "%s(%ds):%.1f (avg):%.1f Mh/s | Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.1f/m",
+ sprintf(statusline, "%s(%ds):%.1f (avg):%.1f %sh/s | Q:%d A:%d R:%d HW:%d E:%.0f%% U:%.1f/m",
want_per_device_stats ? "ALL " : "",
- opt_log_interval, rolling, total_mhashes_done / total_secs,
+ opt_log_interval, rolling, total_mhashes_done / total_secs, opt_scrypt ? "K" : "M",
total_getworks, total_accepted, total_rejected, hw_errors, efficiency, utility);
@@ -4604,6 +4608,10 @@ static void *watchdog_thread(void __maybe_unused *userdata)
if (thr->getwork || *denable == DEV_DISABLED)
continue;
+#ifdef WANT_CPUMINE
+ if (!strcmp(cgpu->api->dname, "cpu"))
+ continue;
+#endif
if (cgpu->rolling < WATCHDOG_LOW_HASH)
cgpu->low_count++;
else
diff --git a/scrypt.c b/scrypt.c
index 569eeb9..4334bcf 100644
--- a/scrypt.c
+++ b/scrypt.c
@@ -434,19 +434,20 @@ bool scanhash_scrypt(struct thr_info *thr, const unsigned char *pmidstate, unsig
data[19] = n;
tmp_hash7 = scrypt_1024_1_1_256_sp(data, scratchbuf);
- if (tmp_hash7 <= Htarg) {
+ if (unlikely(tmp_hash7 <= Htarg)) {
((uint32_t *)pdata)[19] = byteswap(n);
*last_nonce = n;
ret = true;
break;
}
- if ((n >= max_nonce) || thr->work_restart) {
+ if (unlikely((n >= max_nonce) || thr->work_restart)) {
*last_nonce = n;
break;
}
}
out_ret:
+ free(scratchbuf);;
return ret;
}