From ff0afb94eced958f66ee87575d3225402b7891c8 Mon Sep 17 00:00:00 2001 From: Kano Date: Tue, 3 Jul 2012 13:14:30 +1000 Subject: [PATCH] Add API Notify counter 'Comms Error' --- API-README | 1 + api.c | 4 ++++ driver-bitforce.c | 4 ++-- miner.h | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/API-README b/API-README index 9c633bdb..df905ef3 100644 --- a/API-README +++ b/API-README @@ -313,6 +313,7 @@ API V1.14 Modified API commands: 'stats' - more icarus timing stats added + 'notify' - include new device comms error counter The internal code for handling data was rewritten (~25% of the code) Completely backward compatible diff --git a/api.c b/api.c index 2622b161..06a10b60 100644 --- a/api.c +++ b/api.c @@ -2419,6 +2419,9 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson, __maybe_unuse case REASON_DEV_THERMAL_CUTOFF: reason = REASON_DEV_THERMAL_CUTOFF_STR; break; + case REASON_DEV_COMMS_ERROR: + reason = REASON_DEV_COMMS_ERROR_STR; + break; default: reason = REASON_UNKNOWN_STR; break; @@ -2440,6 +2443,7 @@ void notifystatus(int device, struct cgpu_info *cgpu, bool isjson, __maybe_unuse root = api_add_int(root, "*Dev Nostart", &(cgpu->dev_nostart_count), false); root = api_add_int(root, "*Dev Over Heat", &(cgpu->dev_over_heat_count), false); root = api_add_int(root, "*Dev Thermal Cutoff", &(cgpu->dev_thermal_cutoff_count), false); + root = api_add_int(root, "*Dev Comms Error", &(cgpu->dev_comms_error_count), false); if (isjson && (device > 0)) strcat(io_buffer, COMMA); diff --git a/driver-bitforce.c b/driver-bitforce.c index ba239113..cf2d6ca0 100644 --- a/driver-bitforce.c +++ b/driver-bitforce.c @@ -412,8 +412,8 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6 ret = 1; applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id); bitforce->device_last_not_well = time(NULL); - bitforce->device_not_well_reason = REASON_DEV_NOSTART; - bitforce->dev_nostart_count++; + bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR; + bitforce->dev_comms_error_count++; /* empty read buffer */ biforce_clear_buffer(bitforce); } diff --git a/miner.h b/miner.h index c50fa3e3..d3fa2095 100644 --- a/miner.h +++ b/miner.h @@ -272,6 +272,7 @@ enum dev_reason { REASON_DEV_NOSTART, REASON_DEV_OVER_HEAT, REASON_DEV_THERMAL_CUTOFF, + REASON_DEV_COMMS_ERROR, }; #define REASON_NONE "None" @@ -283,6 +284,7 @@ enum dev_reason { #define REASON_DEV_NOSTART_STR "Device failed to start" #define REASON_DEV_OVER_HEAT_STR "Device over heated" #define REASON_DEV_THERMAL_CUTOFF_STR "Device reached thermal cutoff" +#define REASON_DEV_COMMS_ERROR_STR "Device comms error" #define REASON_UNKNOWN_STR "Unknown reason - code bug" #define MIN_SEC_UNSET 99999999 @@ -386,6 +388,7 @@ struct cgpu_info { int dev_nostart_count; int dev_over_heat_count; // It's a warning but worth knowing int dev_thermal_cutoff_count; + int dev_comms_error_count; struct cgminer_stats cgminer_stats; };