Browse Source

Merge commit 'fba1749' into cg_merges_20131023b

Conflicts:
	README.RPC
Luke Dashjr 12 years ago
parent
commit
fbb715a211
2 changed files with 15 additions and 4 deletions
  1. 2 1
      README.RPC
  2. 13 3
      api.c

+ 2 - 1
README.RPC

@@ -476,8 +476,9 @@ Added API command:
  'poolquota' - Set pool quota for load-balance strategy.
 
 Modified API command:
+ 'devs', 'procs' - add 'Elapsed', 'Stale', 'Work Utility', 'Difficulty Stale'
  'pools' - add 'Quota'
- 'summary' - add 'MHS %ds' (where %d is the log interval)
+ 'summary' - add 'Diff1 Work', 'MHS %ds' (where %d is the log interval)
 
 ---------
 

+ 13 - 3
api.c

@@ -1500,13 +1500,14 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 
 	n = find_index_by_cgpu(cgpu);
 
+	double runtime = cgpu_runtime(cgpu);
 	bool enabled = false;
 	double total_mhashes = 0, rolling = 0, utility = 0;
 	enum alive status = cgpu->status;
 	float temp = -1;
-	int accepted = 0, rejected = 0, hw_errors = 0;
+	int accepted = 0, rejected = 0, stale = 0, hw_errors = 0;
 	int diff1 = 0, bad_nonces = 0;
-	double diff_accepted = 0, diff_rejected = 0;
+	double diff_accepted = 0, diff_rejected = 0, diff_stale = 0;
 	int last_share_pool = -1;
 	time_t last_share_pool_time = -1, last_device_valid_work = -1;
 	double last_share_diff = -1;
@@ -1521,10 +1522,12 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 		utility += proc->utility;
 		accepted += proc->accepted;
 		rejected += proc->rejected;
+		stale += proc->stale;
 		hw_errors += proc->hw_errors;
 		diff1 += proc->diff1;
 		diff_accepted += proc->diff_accepted;
 		diff_rejected += proc->diff_rejected;
+		diff_stale += proc->diff_stale;
 		bad_nonces += proc->bad_nonces;
 		if (status != proc->status)
 			status = LIFE_MIXED;
@@ -1548,7 +1551,9 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 	root = api_add_string(root, "Status", status2str(status), false);
 	if (temp > 0)
 		root = api_add_temp(root, "Temperature", &temp, false);
-	double mhs = total_mhashes / cgpu_runtime(cgpu);
+	
+	root = api_add_elapsed(root, "Elapsed", &runtime, false);
+	double mhs = total_mhashes / runtime;
 	root = api_add_mhs(root, "MHS av", &mhs, false);
 	char mhsname[27];
 	sprintf(mhsname, "MHS %ds", opt_log_interval);
@@ -1557,15 +1562,19 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 	root = api_add_int(root, "Rejected", &rejected, false);
 	root = api_add_int(root, "Hardware Errors", &hw_errors, false);
 	root = api_add_utility(root, "Utility", &utility, false);
+	root = api_add_int(root, "Stale", &stale, false);
 	if (last_share_pool != -1)
 	{
 		root = api_add_int(root, "Last Share Pool", &last_share_pool, false);
 		root = api_add_time(root, "Last Share Time", &last_share_pool_time, false);
 	}
 	root = api_add_mhtotal(root, "Total MH", &total_mhashes, false);
+	double work_utility = diff1 / runtime;
 	root = api_add_int(root, "Diff1 Work", &diff1, false);
+	root = api_add_utility(root, "Work Utility", &work_utility, false);
 	root = api_add_diff(root, "Difficulty Accepted", &diff_accepted, false);
 	root = api_add_diff(root, "Difficulty Rejected", &diff_rejected, false);
+	root = api_add_diff(root, "Difficulty Stale", &diff_stale, false);
 	if (last_share_diff > 0)
 		root = api_add_diff(root, "Last Share Difficulty", &last_share_diff, false);
 	if (last_device_valid_work != -1)
@@ -2071,6 +2080,7 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
 	root = api_add_uint(root, "Remote Failures", &(total_ro), true);
 	root = api_add_uint(root, "Network Blocks", &(new_blocks), true);
 	root = api_add_mhtotal(root, "Total MH", &(total_mhashes_done), true);
+	root = api_add_int(root, "Diff1 Work", &total_diff1, true);
 	root = api_add_utility(root, "Work Utility", &(work_utility), false);
 	root = api_add_diff(root, "Difficulty Accepted", &(total_diff_accepted), true);
 	root = api_add_diff(root, "Difficulty Rejected", &(total_diff_rejected), true);