Browse Source

Include rejected shares as a percentage

Luke Dashjr 13 years ago
parent
commit
15bb0640b0
2 changed files with 34 additions and 9 deletions
  1. 5 5
      README
  2. 29 4
      miner.c

+ 5 - 5
README

@@ -354,7 +354,7 @@ Q quits the application.
 
 
 G gives you something like:
 G gives you something like:
 
 
-GPU 0: [124.2 / 191.3 Mh/s] [A:77  R:33  HW:0]
+GPU 0: [124.2 / 191.3 Mh/s] [A:77  R:33( 42%)  HW:0]
 Temp: 67.0 C
 Temp: 67.0 C
 Fan Speed: 35% (2500 RPM)
 Fan Speed: 35% (2500 RPM)
 Engine Clock: 960 MHz
 Engine Clock: 960 MHz
@@ -387,18 +387,18 @@ dedicated to this program,
 	https://bitcointalk.org/?topic=78192
 	https://bitcointalk.org/?topic=78192
 
 
 The output line shows the following:
 The output line shows the following:
-5s:1713.6 avg:1707.8 u:1710.2 Mh/s | A:729 R:8 S:0 HW:0
+ 5s:1713.6 avg:1707.8 u:1710.2 Mh/s | A:729 R:8(.01%) S:0 HW:0
 
 
 Each column is as follows:
 Each column is as follows:
 5s:  A 5 second exponentially decaying average hash rate
 5s:  A 5 second exponentially decaying average hash rate
 avg: An all time average hash rate
 avg: An all time average hash rate
 u:   An all time average hash rate based on actual accepted shares
 u:   An all time average hash rate based on actual accepted shares
 A:   The number of Accepted shares
 A:   The number of Accepted shares
-R:   The number of Rejected shares
+R:   The number of Rejected shares (and percentage of total submitted)
 S:   Stale shares discarded (not submitted so don't count as rejects)
 S:   Stale shares discarded (not submitted so don't count as rejects)
 HW:  The number of HardWare errors
 HW:  The number of HardWare errors
 
 
- GPU 1: 73.5C 2551RPM | 427.3/443.0/442.1Mh/s | A:8 R:0 HW:0 U:4.39/m
+ GPU 1: 73.5C 2551RPM | 427.3/443.0/442.1Mh/s | A:8 R:0(none) HW:0 U:4.39/m
 
 
 Each column is as follows:
 Each column is as follows:
 Temperature (if supported)
 Temperature (if supported)
@@ -407,7 +407,7 @@ A 5 second exponentially decaying average hash rate
 An all time average hash rate
 An all time average hash rate
 An all time average hash rate based on actual accepted shares
 An all time average hash rate based on actual accepted shares
 The number of accepted shares
 The number of accepted shares
-The number of rejected shares
+The number of rejected shares (and percentage of total submitted)
 The number of hardware erorrs
 The number of hardware erorrs
 The utility defines as the number of shares / minute
 The utility defines as the number of shares / minute
 
 

+ 29 - 4
miner.c

@@ -2277,6 +2277,24 @@ ti_hashrate_bufstr(char**out, float current, float average, float sharebased, en
 	hashrate_to_bufstr(out[2], sharebased, unit, longfmt);
 	hashrate_to_bufstr(out[2], sharebased, unit, longfmt);
 }
 }
 
 
+static const char *
+percentf(unsigned p, unsigned t, char *buf)
+{
+	if (!p)
+		return "none";
+	if (!t)
+		return "100%";
+	p = p * 10000 / (p + t);
+	if (p < 100)
+		sprintf(buf, ".%02u%%", p);  // ".01%"
+	else
+	if (p < 1000)
+		sprintf(buf, "%u.%u%%", p / 100, (p % 100) / 10);  // "9.1%"
+	else
+		sprintf(buf, " %2u%%", p / 100);  // " 99%"
+	return buf;
+}
+
 #ifdef HAVE_CURSES
 #ifdef HAVE_CURSES
 static void adj_width(int var, int *length);
 static void adj_width(int var, int *length);
 #endif
 #endif
@@ -2292,6 +2310,7 @@ static void get_statline2(char *buf, struct cgpu_info *cgpu, bool for_curses)
 	void (*statline_func)(char *, struct cgpu_info *);
 	void (*statline_func)(char *, struct cgpu_info *);
 	enum h2bs_fmt hashrate_style = for_curses ? H2B_SHORT : H2B_SPACED;
 	enum h2bs_fmt hashrate_style = for_curses ? H2B_SHORT : H2B_SPACED;
 	char cHr[h2bs_fmt_size[H2B_NOUNIT]], aHr[h2bs_fmt_size[H2B_NOUNIT]], uHr[h2bs_fmt_size[hashrate_style]];
 	char cHr[h2bs_fmt_size[H2B_NOUNIT]], aHr[h2bs_fmt_size[H2B_NOUNIT]], uHr[h2bs_fmt_size[hashrate_style]];
+	char rejpcbuf[6];
 	
 	
 	if (!opt_show_procs)
 	if (!opt_show_procs)
 		cgpu = cgpu->device;
 		cgpu = cgpu->device;
@@ -2396,22 +2415,24 @@ static void get_statline2(char *buf, struct cgpu_info *cgpu, bool for_curses)
 		adj_width(rejected, &rwidth);
 		adj_width(rejected, &rwidth);
 		adj_width(hwerrs, &hwwidth);
 		adj_width(hwerrs, &hwwidth);
 		
 		
-		tailsprintf(buf, "%s/%s/%s | A:%*d R:%*d HW:%*d",
+		tailsprintf(buf, "%s/%s/%s | A:%*d R:%*d(%s) HW:%*d",
 		            cHrStatsOpt[cHrStatsI],
 		            cHrStatsOpt[cHrStatsI],
 		            aHr, uHr,
 		            aHr, uHr,
 		            awidth, accepted,
 		            awidth, accepted,
 		            rwidth, rejected,
 		            rwidth, rejected,
+		            percentf(rejected, accepted, rejpcbuf),
 		            hwwidth, hwerrs
 		            hwwidth, hwerrs
 		);
 		);
 	}
 	}
 	else
 	else
 #endif
 #endif
 	{
 	{
-		tailsprintf(buf, "%ds:%s avg:%s u:%s | A:%d R:%d HW:%d",
+		tailsprintf(buf, "%ds:%s avg:%s u:%s | A:%d R:%d(%s) HW:%d",
 			opt_log_interval,
 			opt_log_interval,
 			cHr, aHr, uHr,
 			cHr, aHr, uHr,
 			accepted,
 			accepted,
 			rejected,
 			rejected,
+			percentf(rejected, accepted, rejpcbuf),
 			hwerrs);
 			hwerrs);
 	}
 	}
 	
 	
@@ -5834,6 +5855,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	double local_mhashes = (double)hashes_done / 1000000.0;
 	double local_mhashes = (double)hashes_done / 1000000.0;
 	bool showlog = false;
 	bool showlog = false;
 	char cHr[h2bs_fmt_size[H2B_NOUNIT]], aHr[h2bs_fmt_size[H2B_NOUNIT]], uHr[h2bs_fmt_size[H2B_SPACED]];
 	char cHr[h2bs_fmt_size[H2B_NOUNIT]], aHr[h2bs_fmt_size[H2B_NOUNIT]], uHr[h2bs_fmt_size[H2B_SPACED]];
+	char rejpcbuf[6];
 	struct thr_info *thr;
 	struct thr_info *thr;
 
 
 	/* Update the last time this thread reported in */
 	/* Update the last time this thread reported in */
@@ -5917,12 +5939,15 @@ static void hashmeter(int thr_id, struct timeval *diff,
 		utility_to_hashrate(total_diff_accepted / (total_secs ?: 1) * 60),
 		utility_to_hashrate(total_diff_accepted / (total_secs ?: 1) * 60),
 		H2B_SPACED);
 		H2B_SPACED);
 
 
-	sprintf(statusline, "%s%ds:%s avg:%s u:%s | A:%d R:%d S:%d HW:%d",
+	sprintf(statusline, "%s%ds:%s avg:%s u:%s | A:%d R:%d(%s) S:%d HW:%d",
 		want_per_device_stats ? "ALL " : "",
 		want_per_device_stats ? "ALL " : "",
 		opt_log_interval,
 		opt_log_interval,
 		cHr, aHr,
 		cHr, aHr,
 		uHr,
 		uHr,
-		total_accepted, total_rejected, total_stale,
+		total_accepted,
+		total_rejected,
+		percentf(total_rejected, total_accepted, rejpcbuf),
+		total_stale,
 		hw_errors);
 		hw_errors);