API V1.25 - add 'Last Valid Work' time for each device
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
diff --git a/API-README b/API-README
index c1c4ca4..567f165 100644
--- a/API-README
+++ b/API-README
@@ -140,6 +140,8 @@ The list of requests - a (*) means it requires privileged access - and replies a
Last Share Time=NNN, <- standand long time in seconds
(or 0 if none) of last accepted share
Last Share Pool=N, <- pool number (or -1 if none)
+ Last Valid Work=NNN, <- standand long time in seconds
+ of last work returned that wasn't an HW:
Will not report PGAs if PGA mining is disabled
Will not report CPUs if CPU mining is disabled
@@ -412,7 +414,14 @@ miner.php - an example web page to access the API
Feature Changelog for external applications using the API:
-API V1.24
+API V1.25
+
+Modified API commands:
+ 'devs' 'gpu' and 'pga' - add 'Last Valid Work'
+
+----------
+
+API V1.24 (cgminer v2.11.0)
Added API commands:
'zero'
@@ -420,6 +429,7 @@ Added API commands:
Modified API commands:
'pools' - add 'Best Share'
'devs' and 'pga' - add 'No Device' for PGAs if MMQ or BFL compiled
+ 'stats' - add pool: 'Net Bytes Sent', 'Net Bytes Recv'
----------
diff --git a/api.c b/api.c
index 9140df6..e23548a 100644
--- a/api.c
+++ b/api.c
@@ -133,7 +133,7 @@ static const char SEPARATOR = '|';
#define SEPSTR "|"
static const char GPUSEP = ',';
-static const char *APIVERSION = "1.24";
+static const char *APIVERSION = "1.25";
static const char *DEAD = "Dead";
#if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA)
static const char *SICK = "Sick";
@@ -1623,6 +1623,7 @@ static void cpustatus(struct io_data *io_data, int cpu, bool isjson, bool precom
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);
+ root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
root = print_data(root, buf, isjson, precom);
io_add(io_data, buf);
diff --git a/cgminer.c b/cgminer.c
index 7dcf204..3c70257 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5406,6 +5406,10 @@ static bool hashtest(struct thr_info *thr, struct work *work)
goto out;
}
+ mutex_lock(&stats_lock);
+ thr->cgpu->last_device_valid_work = time(NULL);
+ mutex_unlock(&stats_lock);
+
ret = fulltest(hash2, work->target);
if (!ret) {
applog(LOG_INFO, "Share below target");
diff --git a/miner.h b/miner.h
index 5be502f..a6872e4 100644
--- a/miner.h
+++ b/miner.h
@@ -497,6 +497,7 @@ struct cgpu_info {
int last_share_pool;
time_t last_share_pool_time;
double last_share_diff;
+ time_t last_device_valid_work;
time_t device_last_well;
time_t device_last_not_well;