usb timeouts - min/max also
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
diff --git a/api.c b/api.c
index 50bbbbf..b67cff4 100644
--- a/api.c
+++ b/api.c
@@ -3054,17 +3054,23 @@ static int itemstats(struct io_data *io_data, int i, char *id, struct cgminer_st
"%"PRIu64" 0", cgpu->usbinfo.tmo_count);
} else {
snprintf(details, sizeof(details),
- "%"PRIu64" %d=%d/%"PRIu64"/%"PRIu64
- " %d=%d/%"PRIu64"/%"PRIu64
- " %d=%d/%"PRIu64"/%"PRIu64" ",
+ "%"PRIu64" %d=%d/%d/%d/%"PRIu64"/%"PRIu64
+ " %d=%d/%d/%d/%"PRIu64"/%"PRIu64
+ " %d=%d/%d/%d/%"PRIu64"/%"PRIu64" ",
cgpu->usbinfo.tmo_count,
USB_TMO_0, cgpu->usbinfo.usb_tmo[0].count,
+ cgpu->usbinfo.usb_tmo[0].min_tmo,
+ cgpu->usbinfo.usb_tmo[0].max_tmo,
cgpu->usbinfo.usb_tmo[0].total_over,
cgpu->usbinfo.usb_tmo[0].total_tmo,
USB_TMO_1, cgpu->usbinfo.usb_tmo[1].count,
+ cgpu->usbinfo.usb_tmo[1].min_tmo,
+ cgpu->usbinfo.usb_tmo[1].max_tmo,
cgpu->usbinfo.usb_tmo[1].total_over,
cgpu->usbinfo.usb_tmo[1].total_tmo,
USB_TMO_2, cgpu->usbinfo.usb_tmo[2].count,
+ cgpu->usbinfo.usb_tmo[2].min_tmo,
+ cgpu->usbinfo.usb_tmo[2].max_tmo,
cgpu->usbinfo.usb_tmo[2].total_over,
cgpu->usbinfo.usb_tmo[2].total_tmo);
}
diff --git a/usbutils.c b/usbutils.c
index 3da8dc2..a0dbbe3 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2135,12 +2135,13 @@ static void stats(struct cgpu_info *cgpu, struct timeval *tv_start, struct timev
// timeout checks are only done when stats are enabled
extrams = SECTOMS(tdiff(tv_finish, tv_start)) - timeout;
if (extrams >= USB_TMO_0) {
+ uint32_t totms = (uint32_t)(timeout + extrams);
int offset = 0;
if (extrams >= USB_TMO_2) {
applog(LOG_ERR, "%s%i: TIMEOUT %s took %dms but was %dms",
cgpu->drv->name, cgpu->device_id,
- usb_cmdname(cmd), extrams+timeout, timeout) ;
+ usb_cmdname(cmd), totms, timeout) ;
offset = 2;
} else if (extrams >= USB_TMO_1)
offset = 1;
@@ -2148,6 +2149,15 @@ static void stats(struct cgpu_info *cgpu, struct timeval *tv_start, struct timev
cgpu->usbinfo.usb_tmo[offset].count++;
cgpu->usbinfo.usb_tmo[offset].total_over += extrams;
cgpu->usbinfo.usb_tmo[offset].total_tmo += timeout;
+ if (cgpu->usbinfo.usb_tmo[offset].min_tmo == 0) {
+ cgpu->usbinfo.usb_tmo[offset].min_tmo = totms;
+ cgpu->usbinfo.usb_tmo[offset].max_tmo = totms;
+ } else {
+ if (cgpu->usbinfo.usb_tmo[offset].min_tmo > totms)
+ cgpu->usbinfo.usb_tmo[offset].min_tmo = totms;
+ if (cgpu->usbinfo.usb_tmo[offset].max_tmo < totms)
+ cgpu->usbinfo.usb_tmo[offset].max_tmo = totms;
+ }
}
details = &(usb_stats[cgpu->usbinfo.usbstat - 1].details[cmd * 2 + seq]);
diff --git a/usbutils.h b/usbutils.h
index abfcc57..cc85577 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -193,6 +193,8 @@ struct cg_usb_device {
struct cg_usb_tmo {
uint32_t count;
+ uint32_t min_tmo;
+ uint32_t max_tmo;
uint64_t total_over;
uint64_t total_tmo;
};