Browse Source

API V1.25 - add 'Last Valid Work' time for each device

Kano 13 years ago
parent
commit
c14f2ec642
4 changed files with 18 additions and 2 deletions
  1. 11 1
      API-README
  2. 2 1
      api.c
  3. 4 0
      cgminer.c
  4. 1 0
      miner.h

+ 11 - 1
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'
 
 ----------
 

+ 2 - 1
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);

+ 4 - 0
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");

+ 1 - 0
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;