Browse Source

Format totals statline the same way as individual device/processor statlines

Luke Dashjr 12 years ago
parent
commit
fc149b90e7
2 changed files with 86 additions and 39 deletions
  1. 12 17
      README
  2. 74 22
      miner.c

+ 12 - 17
README

@@ -412,29 +412,24 @@ E  is Efficiency defined as number of shares accepted (multiplied by their
 U  is Utility defined as the number of shares / minute
 BS is the all time Best Share difficulty you've found
 
-The output line shows the following:
- 5s:1713.6 avg:1707.8 u:1710.2 Mh/s | A:729 R:8+0(.01%) HW:0/.81%
+The totals line shows the following:
+ (32)   75.0C | 171.3/170.8/171.2Gh/s | A:729 R:8+0(.01%) HW:0/.81%
 
 Each column is as follows:
-5s:  A 5 second exponentially decaying average hash rate
-avg: An all time average hash rate
-u:   An all time average hash rate based on actual accepted shares
-A:   The number of Accepted shares
-R:   The number of Rejected shares, stale shares discarded (never submitted),
-     and the percentage these are of total found.
-HW:  The number of HardWare errors, and percentage invalid of nonces returned
+  The number of processors registered with BFGMiner
+  Hottest temperature reported by any processor
+  5 second exponentially decaying average hash rate
+  An all time average hash rate
+  An all time average hash rate based on actual accepted shares
+  The number of Accepted shares
+  The number of Rejected shares and stale shares discarded (never submitted),
+      and the percentage these are of total found.
+  The number of HardWare errors, and percentage invalid of nonces returned
 
 Each device shows:
  BFL 2: 74.0C | 51.97/58.90/57.17Gh/s | A:847 R:15+0(.54%) HW:496/.91%
 
-Column are as follows:
-Temperature (if supported)
-5 second exponentially decaying average hash rate
-An all time average hash rate
-An all time average hash rate based on actual accepted shares
-The number of accepted shares
-The number of rejected plus discarded shares (and percentage of total submitted)
-The number of hardware errors and percentage of nonces invalid
+Columns are the same as in the totals line.
 
 
 ---

+ 74 - 22
miner.c

@@ -2470,11 +2470,34 @@ percentf2(double p, double t, char *buf)
 static void adj_width(int var, int *length);
 #endif
 
-void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_show_procs)
-{
 #ifdef HAVE_CURSES
+static
+void format_statline(char *buf, const char *cHr, const char *aHr, const char *uHr, int accepted, int rejected, int stale, int wnotaccepted, int waccepted, int hwerrs, int badnonces, int allnonces)
+{
 	static int awidth = 1, rwidth = 1, swidth = 1, hwwidth = 1;
-#else
+	char rejpcbuf[6];
+	char bnbuf[6];
+	
+	adj_width(accepted, &awidth);
+	adj_width(rejected, &rwidth);
+	adj_width(stale, &swidth);
+	adj_width(hwerrs, &hwwidth);
+	
+	tailsprintf(buf, "%s/%s/%s | A:%*d R:%*d+%*d(%s) HW:%*d/%s",
+	            cHr, aHr, uHr,
+	            awidth, accepted,
+	            rwidth, rejected,
+	            swidth, stale,
+	            percentf(wnotaccepted, waccepted, rejpcbuf),
+	            hwwidth, hwerrs,
+	            percentf2(badnonces, allnonces, bnbuf)
+	);
+}
+#endif
+
+void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_show_procs)
+{
+#ifndef HAVE_CURSES
 	assert(for_curses == false);
 #endif
 	struct device_drv *drv = cgpu->drv;
@@ -2608,21 +2631,13 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 		if (unlikely(all_off))
 			cHrStatsI = 2;
 		
-		adj_width(accepted, &awidth);
-		adj_width(rejected, &rwidth);
-		adj_width(stale, &swidth);
-		adj_width(hwerrs, &hwwidth);
-		
-		tailsprintf(buf, "%s/%s/%s | A:%*d R:%*d+%*d(%s) HW:%*d/%s",
-		            cHrStatsOpt[cHrStatsI],
-		            aHr, uHr,
-		            awidth, accepted,
-		            rwidth, rejected,
-		            swidth, stale,
-		            percentf(wnotaccepted, waccepted, rejpcbuf),
-		            hwwidth, hwerrs,
-		            percentf2(badnonces, allnonces, bnbuf)
-		);
+		format_statline(buf,
+		                cHrStatsOpt[cHrStatsI],
+		                aHr, uHr,
+		                accepted, rejected, stale,
+		                wnotaccepted, waccepted,
+		                hwerrs,
+		                badnonces, allnonces);
 	}
 	else
 #endif
@@ -6272,6 +6287,7 @@ void thread_reportout(struct thr_info *thr)
 static void hashmeter(int thr_id, struct timeval *diff,
 		      uint64_t hashes_done)
 {
+	char logstatusline[256];
 	struct timeval temp_tv_end, total_diff;
 	double secs;
 	double local_secs;
@@ -6360,13 +6376,49 @@ static void hashmeter(int thr_id, struct timeval *diff,
 
 	multi_format_unit_array(
 		((char*[]){cHr, aHr, uHr}),
-		true, "h/s", H2B_SPACED,
+		true, "h/s", H2B_SHORT,
 		3,
 		1e6*rolling,
 		1e6*total_mhashes_done / total_secs,
 		utility_to_hashrate(total_diff_accepted / (total_secs ?: 1) * 60));
 
-	sprintf(statusline, "%s%ds:%s avg:%s u:%s | A:%d R:%d+%d(%s) HW:%d/%s",
+#ifdef HAVE_CURSES
+	if (curses_active_locked()) {
+		float temp = 0;
+		struct cgpu_info *proc;
+		int i;
+		
+		sprintf(statusline, "(%d)    ", total_devices);
+		
+		// Find the highest temperature of all processors
+		for (i = 0; i < total_devices; ++i)
+		{
+			proc = get_devices(i);
+			if (proc->temp > temp)
+				temp = proc->temp;
+		}
+		if (temp > 0.)
+			sprintf(&statusline[7], "%4.1fC | ", temp);
+		else
+			strcpy(&statusline[7], "      | ");
+		
+		format_statline(&statusline[15],
+		                cHr, aHr,
+		                uHr,
+		                total_accepted,
+		                total_rejected,
+		                total_stale,
+		                total_diff_rejected + total_diff_stale, total_diff_accepted,
+		                hw_errors, total_bad_nonces, total_diff1);
+		unlock_curses();
+	}
+#endif
+	
+	// Add a space
+	memmove(&uHr[6], &uHr[5], strlen(&uHr[5]) + 1);
+	uHr[5] = ' ';
+	
+	sprintf(logstatusline, "%s%ds:%s avg:%s u:%s | A:%d R:%d+%d(%s) HW:%d/%s",
 		want_per_device_stats ? "ALL " : "",
 		opt_log_interval,
 		cHr, aHr,
@@ -6386,10 +6438,10 @@ out_unlock:
 
 	if (showlog) {
 		if (!curses_active) {
-			printf("%s          \r", statusline);
+			printf("%s          \r", logstatusline);
 			fflush(stdout);
 		} else
-			applog(LOG_INFO, "%s", statusline);
+			applog(LOG_INFO, "%s", logstatusline);
 	}
 }