Revert "upgrade some int to int64_t to avoid overflows in reporting" This reverts commit 36802ace37ad6bbcfd995d041b2add3906f8f98b.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
diff --git a/api.c b/api.c
index ed28b42..ef63e95 100644
--- a/api.c
+++ b/api.c
@@ -916,10 +916,6 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
api_data->data = (void *)malloc(sizeof(uint64_t));
*((uint64_t *)(api_data->data)) = *((uint64_t *)data);
break;
- case API_INT64:
- api_data->data = (void *)malloc(sizeof(int64_t));
- *((int64_t *)(api_data->data)) = *((int64_t *)data);
- break;
case API_DOUBLE:
case API_ELAPSED:
case API_MHS:
@@ -1016,11 +1012,6 @@ struct api_data *api_add_uint64(struct api_data *root, char *name, uint64_t *dat
return api_add_data_full(root, name, API_UINT64, (void *)data, copy_data);
}
-struct api_data *api_add_int64(struct api_data *root, char *name, int64_t *data, bool copy_data)
-{
- return api_add_data_full(root, name, API_INT64, (void *)data, copy_data);
-}
-
struct api_data *api_add_double(struct api_data *root, char *name, double *data, bool copy_data)
{
return api_add_data_full(root, name, API_DOUBLE, (void *)data, copy_data);
@@ -1214,9 +1205,6 @@ static struct api_data *print_data(struct io_data *io_data, struct api_data *roo
case API_UINT64:
snprintf(buf, sizeof(buf), "%"PRIu64, *((uint64_t *)(root->data)));
break;
- case API_INT64:
- snprintf(buf, sizeof(buf), "%"PRId64, *((int64_t *)(root->data)));
- break;
case API_TIME:
snprintf(buf, sizeof(buf), "%lu", *((unsigned long *)(root->data)));
break;
@@ -2031,7 +2019,7 @@ static void ascstatus(struct io_data *io_data, int asc, bool isjson, bool precom
root = api_add_int(root, "Last Share Pool", &last_share_pool, false);
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
- root = api_add_int64(root, "Diff1 Work", &(cgpu->diff1), false);
+ root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
@@ -2119,7 +2107,7 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false);
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false);
root = api_add_freq(root, "Frequency", &frequency, false);
- root = api_add_int64(root, "Diff1 Work", &(cgpu->diff1), false);
+ root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false);
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
@@ -2518,8 +2506,8 @@ static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
root = api_add_int(root, "Quota", &pool->quota, false);
root = api_add_string(root, "Long Poll", lp, false);
root = api_add_uint(root, "Getworks", &(pool->getwork_requested), false);
- root = api_add_int64(root, "Accepted", &(pool->accepted), false);
- root = api_add_int64(root, "Rejected", &(pool->rejected), false);
+ root = api_add_int(root, "Accepted", &(pool->accepted), false);
+ root = api_add_int(root, "Rejected", &(pool->rejected), false);
root = api_add_int(root, "Works", &pool->works, false);
root = api_add_uint(root, "Discarded", &(pool->discarded_work), false);
root = api_add_uint(root, "Stale", &(pool->stale_shares), false);
@@ -2527,7 +2515,7 @@ static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
root = api_add_uint(root, "Remote Failures", &(pool->remotefail_occasions), false);
root = api_add_escape(root, "User", pool->rpc_user, false);
root = api_add_time(root, "Last Share Time", &(pool->last_share_time), false);
- root = api_add_int64(root, "Diff1 Shares", &(pool->diff1), false);
+ root = api_add_int(root, "Diff1 Shares", &(pool->diff1), false);
if (pool->rpc_proxy) {
root = api_add_const(root, "Proxy Type", proxytype(pool->rpc_proxytype), false);
root = api_add_escape(root, "Proxy", pool->rpc_proxy, false);
@@ -2586,13 +2574,13 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
root = api_add_mhs(root, "MHS 5m", &rolling5, false);
root = api_add_mhs(root, "MHS 15m", &rolling15, false);
root = api_add_uint(root, "Found Blocks", &(found_blocks), true);
- root = api_add_int64(root, "Getworks", &(total_getworks), true);
- root = api_add_int64(root, "Accepted", &(total_accepted), true);
- root = api_add_int64(root, "Rejected", &(total_rejected), true);
+ root = api_add_int(root, "Getworks", &(total_getworks), true);
+ root = api_add_int(root, "Accepted", &(total_accepted), true);
+ root = api_add_int(root, "Rejected", &(total_rejected), true);
root = api_add_int(root, "Hardware Errors", &(hw_errors), true);
root = api_add_utility(root, "Utility", &(utility), false);
- root = api_add_int64(root, "Discarded", &(total_discarded), true);
- root = api_add_int64(root, "Stale", &(total_stale), true);
+ root = api_add_int(root, "Discarded", &(total_discarded), true);
+ root = api_add_int(root, "Stale", &(total_stale), true);
root = api_add_uint(root, "Get Failures", &(total_go), true);
root = api_add_uint(root, "Local Work", &(local_work), true);
root = api_add_uint(root, "Remote Failures", &(total_ro), true);
diff --git a/cgminer.c b/cgminer.c
index 8706cc8..6769f92 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -309,8 +309,8 @@ cglock_t control_lock;
pthread_mutex_t stats_lock;
int hw_errors;
-int64_t total_accepted, total_rejected, total_diff1;
-int64_t total_getworks, total_stale, total_discarded;
+int total_accepted, total_rejected, total_diff1;
+int total_getworks, total_stale, total_discarded;
double total_diff_accepted, total_diff_rejected, total_diff_stale;
static int staged_rollable;
unsigned int new_blocks;
@@ -2538,12 +2538,12 @@ static void curses_print_status(void)
wclrtoeol(statuswin);
if (opt_widescreen) {
cg_mvwprintw(statuswin, 3, 0, " A:%.0f R:%.0f HW:%d WU:%.1f/m |"
- " ST: %d SS: %"PRId64" NB: %d LW: %d GF: %d RF: %d",
+ " ST: %d SS: %d NB: %d LW: %d GF: %d RF: %d",
total_diff_accepted, total_diff_rejected, hw_errors,
total_diff1 / total_secs * 60,
total_staged(), total_stale, new_blocks, local_work, total_go, total_ro);
} else if (alt_status) {
- cg_mvwprintw(statuswin, 3, 0, " ST: %d SS: %"PRId64" NB: %d LW: %d GF: %d RF: %d",
+ cg_mvwprintw(statuswin, 3, 0, " ST: %d SS: %d NB: %d LW: %d GF: %d RF: %d",
total_staged(), total_stale, new_blocks, local_work, total_go, total_ro);
} else {
cg_mvwprintw(statuswin, 3, 0, " A:%.0f R:%.0f HW:%d WU:%.1f/m",
@@ -4760,9 +4760,9 @@ static void display_pool_summary(struct pool *pool)
if (!pool->has_stratum)
wlog("%s own long-poll support\n", pool->hdr_path ? "Has" : "Does not have");
wlog(" Queued work requests: %d\n", pool->getwork_requested);
- wlog(" Share submissions: %"PRId64"\n", pool->accepted + pool->rejected);
- wlog(" Accepted shares: %"PRId64"\n", pool->accepted);
- wlog(" Rejected shares: %"PRId64"\n", pool->rejected);
+ wlog(" Share submissions: %d\n", pool->accepted + pool->rejected);
+ wlog(" Accepted shares: %d\n", pool->accepted);
+ wlog(" Rejected shares: %d\n", pool->rejected);
wlog(" Accepted difficulty shares: %1.f\n", pool->diff_accepted);
wlog(" Rejected difficulty shares: %1.f\n", pool->diff_rejected);
if (pool->accepted || pool->rejected)
@@ -5513,7 +5513,7 @@ retry:
wlogprint("Hardware Errors %d\n", cgpu->hw_errors);
wlogprint("Last Share Pool %d\n", cgpu->last_share_pool_time > 0 ? cgpu->last_share_pool : -1);
wlogprint("Total MH %.1f\n", cgpu->total_mhashes);
- wlogprint("Diff1 Work %"PRId64"\n", cgpu->diff1);
+ wlogprint("Diff1 Work %d\n", cgpu->diff1);
wlogprint("Difficulty Accepted %.1f\n", cgpu->diff_accepted);
wlogprint("Difficulty Rejected %.1f\n", cgpu->diff_rejected);
wlogprint("Last Share Difficulty %.1f\n", cgpu->last_share_diff);
@@ -8123,10 +8123,10 @@ static void *watchpool_thread(void __maybe_unused *userdata)
/* Get a rolling utility per pool over 10 mins */
if (intervals > 19) {
- double shares = pool->diff1 - pool->last_shares;
+ int shares = pool->diff1 - pool->last_shares;
pool->last_shares = pool->diff1;
- pool->utility = (pool->utility + shares * 0.63) / 1.63;
+ pool->utility = (pool->utility + (double)shares * 0.63) / 1.63;
pool->shares = pool->utility;
}
@@ -8366,9 +8366,9 @@ void print_summary(void)
applog(LOG_WARNING, "Average hashrate: %.1f Mhash/s", displayed_hashes);
applog(LOG_WARNING, "Solved blocks: %d", found_blocks);
applog(LOG_WARNING, "Best share difficulty: %s", best_share);
- applog(LOG_WARNING, "Share submissions: %"PRId64, total_accepted + total_rejected);
- applog(LOG_WARNING, "Accepted shares: %"PRId64, total_accepted);
- applog(LOG_WARNING, "Rejected shares: %"PRId64, total_rejected);
+ applog(LOG_WARNING, "Share submissions: %d", total_accepted + total_rejected);
+ applog(LOG_WARNING, "Accepted shares: %d", total_accepted);
+ applog(LOG_WARNING, "Rejected shares: %d", total_rejected);
applog(LOG_WARNING, "Accepted difficulty shares: %1.f", total_diff_accepted);
applog(LOG_WARNING, "Rejected difficulty shares: %1.f", total_diff_rejected);
if (total_accepted || total_rejected)
@@ -8377,7 +8377,7 @@ void print_summary(void)
applog(LOG_WARNING, "Utility (accepted shares / min): %.2f/min", utility);
applog(LOG_WARNING, "Work Utility (diff1 shares solved / min): %.2f/min\n", work_util);
- applog(LOG_WARNING, "Stale submissions discarded due to new blocks: %"PRId64, total_stale);
+ applog(LOG_WARNING, "Stale submissions discarded due to new blocks: %d", total_stale);
applog(LOG_WARNING, "Unable to get work from server occasions: %d", total_go);
applog(LOG_WARNING, "Work items generated locally: %d", local_work);
applog(LOG_WARNING, "Submitting work remotely delay occasions: %d", total_ro);
@@ -8390,9 +8390,9 @@ void print_summary(void)
applog(LOG_WARNING, "Pool: %s", pool->rpc_url);
if (pool->solved)
applog(LOG_WARNING, "SOLVED %d BLOCK%s!", pool->solved, pool->solved > 1 ? "S" : "");
- applog(LOG_WARNING, " Share submissions: %"PRId64, pool->accepted + pool->rejected);
- applog(LOG_WARNING, " Accepted shares: %"PRId64, pool->accepted);
- applog(LOG_WARNING, " Rejected shares: %"PRId64, pool->rejected);
+ applog(LOG_WARNING, " Share submissions: %d", pool->accepted + pool->rejected);
+ applog(LOG_WARNING, " Accepted shares: %d", pool->accepted);
+ applog(LOG_WARNING, " Rejected shares: %d", pool->rejected);
applog(LOG_WARNING, " Accepted difficulty shares: %1.f", pool->diff_accepted);
applog(LOG_WARNING, " Rejected difficulty shares: %1.f", pool->diff_rejected);
if (pool->accepted || pool->rejected)
diff --git a/miner.h b/miner.h
index f25dc78..42a0782 100644
--- a/miner.h
+++ b/miner.h
@@ -486,7 +486,7 @@ struct cgpu_info {
double temp;
int cutofftemp;
- int64_t diff1;
+ int diff1;
double diff_accepted;
double diff_rejected;
int last_share_pool;
@@ -1110,8 +1110,8 @@ extern double total_rolling;
extern double total_mhashes_done;
extern unsigned int new_blocks;
extern unsigned int found_blocks;
-extern int64_t total_accepted, total_rejected, total_diff1;
-extern int64_t total_getworks, total_stale, total_discarded;
+extern int total_accepted, total_rejected, total_diff1;;
+extern int total_getworks, total_stale, total_discarded;
extern double total_diff_accepted, total_diff_rejected, total_diff_stale;
extern unsigned int local_work;
extern unsigned int total_go, total_ro;
@@ -1152,11 +1152,11 @@ struct stratum_work {
struct pool {
int pool_no;
int prio;
- int64_t accepted, rejected;
+ int accepted, rejected;
int seq_rejects;
int seq_getfails;
int solved;
- int64_t diff1;
+ int diff1;
char diff[8];
int quota;
int quota_gcd;
@@ -1480,7 +1480,6 @@ enum api_data_type {
API_UINT32,
API_HEX32,
API_UINT64,
- API_INT64,
API_DOUBLE,
API_ELAPSED,
API_BOOL,