From 39bdec8bbe1053f3c85bfb04935a0490de8014ff Mon Sep 17 00:00:00 2001 From: Znort 987 Date: Mon, 15 Aug 2011 11:57:31 +0200 Subject: [PATCH] Various minor changes - Fixed a type bug on 32bit platform in algo bench - Some re-indenting --- main.c | 97 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 35 deletions(-) diff --git a/main.c b/main.c index 35657f71..be0d8b3e 100644 --- a/main.c +++ b/main.c @@ -408,11 +408,13 @@ static double bench_algo_stage3( struct timeval end; struct timeval start; - uint64_t hashes_done = 0; - uint32_t max_nonce = (1<<21); + uint32_t max_nonce = (1<<22); + unsigned long hashes_done = 0; gettimeofday(&start, 0); - #ifdef WANT_VIA_PADLOCK + #if defined(WANT_VIA_PADLOCK) + + // For some reason, the VIA padlock hasher has a different API ... if (ALGO_VIA==algo) { (void)scanhash_via( 0, @@ -424,20 +426,20 @@ static double bench_algo_stage3( ); } else #endif - { - sha256_func func = sha256_funcs[algo]; - (*func)( - 0, - work.midstate, - work.data + 64, - work.hash1, - work.hash, - work.target, - max_nonce, - &hashes_done, - work.blk.nonce - ); - } + { + sha256_func func = sha256_funcs[algo]; + (*func)( + 0, + work.midstate, + work.data + 64, + work.hash1, + work.hash, + work.target, + max_nonce, + &hashes_done, + work.blk.nonce + ); + } gettimeofday(&end, 0); work_restart = NULL; @@ -749,13 +751,29 @@ static void bench_algo( memset(name_spaces_pad, ' ', n); name_spaces_pad[n] = 0; - applog(LOG_ERR, "\"%s\"%s : benchmarking algorithm ...", algo_names[algo], name_spaces_pad); - double rate = bench_algo_stage2(algo); + applog( + LOG_ERR, + "\"%s\"%s : benchmarking algorithm ...", + algo_names[algo], + name_spaces_pad + ); + double rate = bench_algo_stage2(algo); if (rate<0.0) { - applog(LOG_ERR, "\"%s\"%s : algorithm fails on this platform", algo_names[algo], name_spaces_pad); + applog( + LOG_ERR, + "\"%s\"%s : algorithm fails on this platform", + algo_names[algo], + name_spaces_pad + ); } else { - applog(LOG_ERR, "\"%s\"%s : algorithm runs at %.5f MH/s", algo_names[algo], name_spaces_pad, rate); + applog( + LOG_ERR, + "\"%s\"%s : algorithm runs at %.5f MH/s", + algo_names[algo], + name_spaces_pad, + rate + ); if (*best_rate