From 21e6b2704ecd6c64f6477270c9719d51182d02df Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 19 May 2014 22:02:37 +1000 Subject: [PATCH] Use doubles for per client diffs and display the total accepted hashes in the console log --- src/stratifier.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index 938442df..575bd918 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -175,8 +175,8 @@ struct stratum_instance { char enonce1var[12]; uint64_t enonce1_64; - int diff; /* Current diff */ - int old_diff; /* Previous diff */ + double diff; /* Current diff */ + double old_diff; /* Previous diff */ uint64_t diff_change_job_id; /* Last job_id we changed diff */ double dsps5; /* Diff shares per second, 5 minute rolling average */ tv_t ldc; /* Last diff change */ @@ -184,7 +184,7 @@ struct stratum_instance { tv_t first_share; tv_t last_share; int absolute_shares; - int diff_shares; + double diff_shares; bool authorised; @@ -1017,9 +1017,8 @@ static double time_bias(double tdiff, double period) static void add_submit(stratum_instance_t *client, int diff, bool valid) { - double tdiff, bdiff, dsps, drr, network_diff, bias; + double optimal, tdiff, bdiff, dsps, drr, network_diff, bias; uint64_t next_blockid; - int optimal; tv_t now_t; if (valid) { @@ -1061,8 +1060,9 @@ static void add_submit(stratum_instance_t *client, int diff, bool valid) /* FIXME For now show the hashrate every ~1m when the diff is * stable */ if (!(client->ssdc % 18)) { - LOGNOTICE("Client %d worker %s hashrate %.1fGH/s", client->id, - client->workername, dsps * 4.294967296); + LOGNOTICE("Client %d worker %s DiffAcc: %.0f hashrate %.1fGH/s", + client->id, client->workername, client->diff_shares, + dsps * 4.294967296); } return; } @@ -1091,7 +1091,7 @@ static void add_submit(stratum_instance_t *client, int diff, bool valid) client->ssdc = 0; - LOGINFO("Client %d biased dsps %.2f dsps %.2f drr %.2f adjust diff from %d to: %d ", + LOGINFO("Client %d biased dsps %.2f dsps %.2f drr %.2f adjust diff from %.0f to: %.0f ", client->id, dsps, client->dsps5, drr, client->diff, optimal); copy_tv(&client->ldc, &now_t);