aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-06-18 20:41:13 +1200
committerDavid Phillips <david@sighup.nz>2018-06-18 20:41:13 +1200
commitf2e3e195c28c4ab5a4605981f8779fa9a1ef6a06 (patch)
tree8acf51109eb3f9752cea2d3f5a80e405a0f63f33
parent48923aec615908412d00034a4bd69a2200921794 (diff)
downloadsand-leek-f2e3e195c28c4ab5a4605981f8779fa9a1ef6a06.tar.xz
Apply auto-ranging units to current hash rates
-rw-r--r--sand-leek.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sand-leek.c b/sand-leek.c
index 03c236b..b36c87e 100644
--- a/sand-leek.c
+++ b/sand-leek.c
@@ -291,7 +291,11 @@ monitor_progress(unsigned long volatile *khashes, int thread_count) {
unsigned long total_khashes = 0;
unsigned long last_total_khashes = 0;
double hashes_nice = 0;
+ double net_khash_nice = 0;
+ double net_khash_t_nice = 0;
char *hashes_nice_unit = NULL;
+ char *net_khash_nice_unit = NULL;
+ char *net_khash_t_nice_unit = NULL;
struct timespec start = {0, 0};
struct timespec now = {0, 0};
int seconds = 0;
@@ -336,6 +340,8 @@ monitor_progress(unsigned long volatile *khashes, int thread_count) {
remaining_abs = fabs(remaining);
remaining_abs = make_unit_whatsit(time_labels, &remaining_unit, remaining_abs);
+ net_khash_nice = make_unit_whatsit(khash_labels, &net_khash_nice_unit, total_khashes - last_total_khashes);
+ net_khash_t_nice = make_unit_whatsit(khash_labels, &net_khash_t_nice_unit, (double)(total_khashes - last_total_khashes) / (thread_count));
#ifndef SAND_LEEK_DISABLE_COLOUR
if (!no_ansi_esc) {
@@ -343,11 +349,11 @@ monitor_progress(unsigned long volatile *khashes, int thread_count) {
}
#endif
/* FIXME prints incorrect English e.g. "1 billion year" */
- iprintf("[%02d:%02d:%02d:%02d]: %.2f %s hashes%s. Now ~%lu kH/s (%.2f kH/s/thread). Maybe %.1f %s%s %s\r",
+ iprintf("[%02d:%02d:%02d:%02d]: %.2f %s hashes%s. Now ~%.2f %sH/s (%.2f %sH/s/thread). Maybe %.1f %s%s %s\r",
days, hours, minutes, seconds,
hashes_nice, hashes_nice_unit, (hashes_nice >= 1000 ? " (!!)" : ""),
- total_khashes - last_total_khashes,
- (double)(total_khashes - last_total_khashes) / thread_count,
+ net_khash_nice, net_khash_nice_unit,
+ net_khash_t_nice, net_khash_t_nice_unit,
remaining_abs, remaining_unit, (remaining_abs == 1.0 ? "" : "s" ),
(remaining < 0 ? "overdue" : "left")
);