Commit 99b219f99d32e07e8cebd0c188424a0c98910c0c

Con Kolivas 2013-06-28T15:49:33

Merge pull request #460 from kanoi/master Update all screen A/R to instead use DA/DR and device U to WU

diff --git a/README b/README
index 4612372..0866703 100644
--- a/README
+++ b/README
@@ -420,32 +420,31 @@ dedicated to this program,
 	http://forum.bitcoin.org/index.php?topic=28402.0
 
 The output line shows the following:
-(5s):1713.6 (avg):1707.8 Mh/s | A:729  R:8  HW:0  U:22.53/m  WU:22.53/m
+(5s):1713.6 (avg):1707.8 Mh/s | DA:729  DR:8  HW:0  WU:22.53/m
 
 Each column is as follows:
 5s:  A 5 second exponentially decaying average hash rate
 avg: An all time average hash rate
-A:   The number of Accepted shares
-R:   The number of Rejected shares
+DA:  The total difficulty of Accepted shares
+DR:  The total difficulty of Rejected shares
 HW:  The number of HardWare errors
-U:   The Utility defined as the number of shares / minute
 WU:  The Work Utility defined as the number of diff1 shares work / minute
      (accepted or rejected).
 
- GPU 1: 73.5C 2551RPM | 427.3/443.0Mh/s | A:8 R:0 HW:0 U:4.39/m
+ GPU 1: 73.5C 2551RPM | 427.3/443.0Mh/s | DA:8 DR:0 HW:0 WU:4.39/m
 
 Each column is as follows:
 Temperature (if supported)
 Fanspeed (if supported)
 A 5 second exponentially decaying average hash rate
 An all time average hash rate
-The number of accepted shares
-The number of rejected shares
+The total difficulty of accepted shares
+The total difficulty of rejected shares
 The number of hardware erorrs
-The utility defines as the number of shares / minute
+The work utility defined as the number of diff1 shares work / minute
 
 The cgminer status line shows:
- ST: 1  SS: 0  NB: 1  LW: 8  GF: 1  RF: 1  WU:4.4/m
+ ST: 1  SS: 0  NB: 1  LW: 8  GF: 1  RF: 1
 
 ST is STaged work items (ready to use).
 SS is Stale Shares discarded (detected and not submitted so don't count as rejects)
@@ -453,7 +452,6 @@ NB is New Blocks detected on the network
 LW is Locally generated Work items
 GF is Getwork Fail Occasions (server slow to provide work)
 RF is Remote Fail occasions (server slow to accept work)
-WU is Work Utility (Rate of difficulty 1 shares solved per minute)
 
 The block display shows:
 Block: 0074c5e482e34a506d2a051a...  Started: [17:17:22]  Best share: 2.71K
diff --git a/cgminer.c b/cgminer.c
index a514cab..c9e1025 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2018,7 +2018,7 @@ static void get_statline(char *buf, struct cgpu_info *cgpu)
 	char displayed_hashes[16], displayed_rolling[16];
 	uint64_t dh64, dr64;
 	struct timeval now;
-	double dev_runtime;
+	double dev_runtime, wu;
 
 	if (cgpu->dev_start_tv.tv_sec == 0)
 		dev_runtime = total_secs;
@@ -2030,6 +2030,8 @@ static void get_statline(char *buf, struct cgpu_info *cgpu)
 	if (dev_runtime < 1.0)
 		dev_runtime = 1.0;
 
+	wu = cgpu->diff1 / dev_runtime * 60.0;
+
 	dh64 = (double)cgpu->total_mhashes / dev_runtime * 1000000ull;
 	dr64 = (double)cgpu->rolling * 1000000ull;
 	suffix_string(dh64, displayed_hashes, 4);
@@ -2037,14 +2039,14 @@ static void get_statline(char *buf, struct cgpu_info *cgpu)
 
 	sprintf(buf, "%s%d ", cgpu->drv->name, cgpu->device_id);
 	cgpu->drv->get_statline_before(buf, cgpu);
-	tailsprintf(buf, "(%ds):%s (avg):%sh/s | A:%d R:%d HW:%d U:%.1f/m",
+	tailsprintf(buf, "(%ds):%s (avg):%sh/s | DA:%.0f DR:%.0f HW:%d WU:%.1f/m",
 		opt_log_interval,
 		displayed_rolling,
 		displayed_hashes,
-		cgpu->accepted,
-		cgpu->rejected,
+		cgpu->diff_accepted,
+		cgpu->diff_rejected,
 		cgpu->hw_errors,
-		cgpu->utility);
+		wu);
 	cgpu->drv->get_statline(buf, cgpu);
 }
 
@@ -2102,16 +2104,22 @@ static void adj_width(int var, int *length)
 		(*length)++;
 }
 
+static void adj_fwidth(float var, int *length)
+{
+	if ((int)(log10(var) + 1) > *length)
+		(*length)++;
+}
+
 static int dev_width;
 
 static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
 {
-	static int awidth = 1, rwidth = 1, hwwidth = 1, uwidth = 1;
+	static int dawidth = 1, drwidth = 1, hwwidth = 1, wuwidth = 1;
 	char logline[256];
 	char displayed_hashes[16], displayed_rolling[16];
 	uint64_t dh64, dr64;
 	struct timeval now;
-	double dev_runtime;
+	double dev_runtime, wu;
 
 	if (opt_compact)
 		return;
@@ -2133,6 +2141,7 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
 		dev_runtime = 1.0;
 
 	cgpu->utility = cgpu->accepted / dev_runtime * 60;
+	wu = cgpu->diff1 / dev_runtime * 60;
 
 	wmove(statuswin,devcursor + count, 0);
 	wprintw(statuswin, " %s %*d: ", cgpu->drv->name, dev_width, cgpu->device_id);
@@ -2160,17 +2169,17 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
 		wprintw(statuswin, "REST  ");
 	else
 		wprintw(statuswin, "%6s", displayed_rolling);
-	adj_width(cgpu->accepted, &awidth);
-	adj_width(cgpu->rejected, &rwidth);
+	adj_fwidth(cgpu->diff_accepted, &dawidth);
+	adj_fwidth(cgpu->diff_rejected, &drwidth);
 	adj_width(cgpu->hw_errors, &hwwidth);
-	adj_width(cgpu->utility, &uwidth);
+	adj_width(wu, &wuwidth);
 
-	wprintw(statuswin, "/%6sh/s | A:%*d R:%*d HW:%*d U:%*.2f/m",
+	wprintw(statuswin, "/%6sh/s | DA:%*.0f DR:%*.0f HW:%*d WU:%*.2f/m",
 			displayed_hashes,
-			awidth, cgpu->accepted,
-			rwidth, cgpu->rejected,
+			dawidth, cgpu->diff_accepted,
+			drwidth, cgpu->diff_rejected,
 			hwwidth, cgpu->hw_errors,
-		uwidth + 3, cgpu->utility);
+			wuwidth + 3, wu);
 
 	logline[0] = '\0';
 	cgpu->drv->get_statline(logline, cgpu);
@@ -4637,7 +4646,6 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	struct timeval temp_tv_end, total_diff;
 	double secs;
 	double local_secs;
-	double utility;
 	static double local_mhashes_done = 0;
 	static double rolling = 0;
 	double local_mhashes;
@@ -4719,17 +4727,15 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	total_secs = (double)total_diff.tv_sec +
 		((double)total_diff.tv_usec / 1000000.0);
 
-	utility = total_accepted / total_secs * 60;
-
 	dh64 = (double)total_mhashes_done / total_secs * 1000000ull;
 	dr64 = (double)rolling * 1000000ull;
 	suffix_string(dh64, displayed_hashes, 4);
 	suffix_string(dr64, displayed_rolling, 4);
 
-	sprintf(statusline, "%s(%ds):%s (avg):%sh/s | A:%d  R:%d  HW:%d  U:%.1f/m  WU:%.1f/m",
+	sprintf(statusline, "%s(%ds):%s (avg):%sh/s | DA:%.0f  DR:%.0f  HW:%d  WU:%.1f/m",
 		want_per_device_stats ? "ALL " : "",
 		opt_log_interval, displayed_rolling, displayed_hashes,
-		total_accepted, total_rejected, hw_errors, utility,
+		total_diff_accepted, total_diff_rejected, hw_errors,
 		total_diff1 / total_secs * 60);
 
 	local_mhashes_done = 0;