Merge pull request #79 from luke-jr/bugfix_summary Bugfix: Only show each device once in exit summary
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
diff --git a/main.c b/main.c
index 3ba39d5..f19ad20 100644
--- a/main.c
+++ b/main.c
@@ -4905,14 +4905,6 @@ void reinit_device(struct cgpu_info *cgpu)
cgpu->api->reinit_device(cgpu);
}
-/* Determine which are the first threads belonging to a device and if they're
- * active */
-static bool active_device(int thr_id)
-{
- struct cgpu_info *cgpu = thr_info[thr_id].cgpu;
- return cgpu->enabled;
-}
-
/* Makes sure the hashmeter keeps going even if mining threads stall, updates
* the screen at regular intervals, and restarts threads if they appear to have
* died. */
@@ -5084,16 +5076,12 @@ static void *watchdog_thread(void *userdata)
return NULL;
}
-static void log_print_status(int thr_id)
+static void log_print_status(struct cgpu_info *cgpu)
{
- struct cgpu_info *cgpu;
char logline[255];
- cgpu = thr_info[thr_id].cgpu;
- if (cgpu) {
get_statline(logline, cgpu);
applog(LOG_WARNING, "%s", logline);
- }
}
static void print_summary(void)
@@ -5164,9 +5152,9 @@ static void print_summary(void)
applog(LOG_WARNING, "Donated share submissions: %d\n", donationpool.accepted + donationpool.rejected);
applog(LOG_WARNING, "Summary of per device statistics:\n");
- for (i = 0; i < mining_threads; i++) {
- if (active_device(i))
- log_print_status(i);
+ for (i = 0; i < total_devices; ++i) {
+ if (devices[i]->enabled)
+ log_print_status(devices[i]);
}
if (opt_shares)