From cf84c8ce42d8820102ebd55d2e47aa19a3b134b5 Mon Sep 17 00:00:00 2001 From: tcatm Date: Sat, 5 Feb 2011 11:06:11 +0100 Subject: [PATCH] show gpu hashrates in hashmeter --- miner.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/miner.c b/miner.c index 412c217..08a26f3 100644 --- a/miner.c +++ b/miner.c @@ -215,15 +215,10 @@ static void hashmeter(int thr_id, struct timeval *tv_start, secs = (double)diff.tv_sec + ((double)diff.tv_usec / 1000000.0); hashrates[thr_id] = khashes / secs; - - if (opt_debug) - printf("HashMeter(%d): %lu hashes, %.2f khash/sec\n", - thr_id, hashes_done, - khashes / secs); } -static void print_hashmeter(double hashrate) { - printf("\r \rHashMeter: %.2f Mhash/sec", hashrate / 1000); +static void print_hashmeter(double hashrate, char *rates) { + printf("\r \rHashMeter: %.2f Mhash/sec (%s)", hashrate / 1000, rates); fflush(stdout); } @@ -516,10 +511,19 @@ int main (int argc, char *argv[]) while (program_running) { sleep(STAT_SLEEP_INTERVAL); double hashrate = 0; - for(i = 0; i < nDevs; i++) + char rates[128]; + char buffer[16]; + rates[0] = 0; + + for(i = 0; i < nDevs; i++) { hashrate += hashrates[i]; + sprintf(buffer, "%.02f", hashrates[i] / 1000); + strcat(rates, buffer); + + if (i != nDevs-1) strcat(rates, " "); + } - print_hashmeter(hashrate); + print_hashmeter(hashrate, rates); }