aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-05-14 20:14:24 +1200
committerDavid Phillips <david@sighup.nz>2017-05-14 20:14:24 +1200
commitc68548b1f399f8f0ccf1290120aa892cfd11fdc7 (patch)
tree3bfaee0cacdc25d53dfdc2e9b649a808d906aa9c
parent9813b147580d9f42e2484d27ecaa3ab244841ee8 (diff)
downloadsand-leek-c68548b1f399f8f0ccf1290120aa892cfd11fdc7.tar.xz
Add rough current hashrate to status line
-rw-r--r--sand-leek.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sand-leek.c b/sand-leek.c
index 561574e..8ab59d7 100644
--- a/sand-leek.c
+++ b/sand-leek.c
@@ -228,17 +228,21 @@ monitor_progress(unsigned long volatile *khashes, int thread_count) {
int loops = 0;
int i = 0;
unsigned long total_khashes = 0;
+ unsigned long last_total_khashes = 0;
loops = 0;
while (sem_trywait(&working) && errno == EAGAIN) {
sleep(1);
loops++;
+ last_total_khashes = total_khashes;
total_khashes = 0;
/* approximate hashes per second */
for (i = 0; i < thread_count; i++) {
total_khashes += khashes[i];
}
- fprintf(stderr, "Average rate: %.2f kH/s (%.2f kH/s/thread)\r",
+ fprintf(stderr, "Last second: %lu kH/s (%.2f kH/s/thread) | Average: %.2f kH/s (%.2f kH/s/thread)\r",
+ total_khashes - last_total_khashes,
+ (double)(total_khashes - last_total_khashes) / thread_count,
(double)total_khashes / loops,
((double)total_khashes / loops) / thread_count);
}