Browse Source

Merge branch 'tui_no_devapi_statline' into bfgminer

Luke Dashjr 12 years ago
parent
commit
288aede36a
9 changed files with 52 additions and 216 deletions
  1. 18 15
      README
  2. 1 15
      driver-avalon.c
  3. 0 20
      driver-bitforce.c
  4. 3 61
      driver-modminer.c
  5. 20 21
      driver-opencl.c
  6. 3 45
      driver-x6500.c
  7. 0 14
      driver-ztex.c
  8. 6 19
      miner.c
  9. 1 6
      miner.h

+ 18 - 15
README

@@ -332,8 +332,12 @@ The following options are available while running with a single keypress:
 M gives you something like:
 
 Select processor to manage using up/down arrow keys
- ICA 0 :                | 212.4/340.6/448.7Mh/s | A:4 R:0+0(none) HW:0/none
-[E]nable [D]isable
+ BFL 0a: 78.0C |  3.64/ 3.70/ 2.91Gh/s | A:46 R:0+0(none) HW:  2/none
+  BitFORCE SHA256 SC from Butterfly Labs
+Serial: FTWN6T67
+
+[D]isable
+Or press Enter when done
 
 
 P gives you:
@@ -400,19 +404,6 @@ 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
 
- GPU 1: 73.5C 2551RPM | 427.3/443.0/442.1Mh/s | A:8 R:0+0(none) HW:0 U: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
-An all time average hash rate based on actual accepted shares
-The number of accepted shares
-The number of rejected shares (and percentage of total submitted)
-The number of hardware erorrs
-The utility defines as the number of shares / minute
-
 The BFGMiner status line shows:
  ST: 1  GF: 1  NB: 1  AS: 0  RF: 1  E: 2.42  U:22.53/m  BS:2.71k
 
@@ -433,6 +424,18 @@ This shows a short stretch of the current block, the next block's height and
 difficulty (including the network hashrate that difficulty represents), and when
 the search for the new block started.
 
+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
+
 
 ---
 MULTIPOOL

+ 1 - 15
driver-avalon.c

@@ -768,20 +768,6 @@ static inline void adjust_fan(struct avalon_info *info)
 	}
 }
 
-static void get_avalon_statline_before(char *buf, struct cgpu_info *avalon)
-{
-	struct avalon_info *info = avalon->device_data;
-	int lowfan = 10000;
-
-	/* Find the lowest fan speed of the ASIC cooling fans. */
-	if (info->fan1 >= 0 && info->fan1 < lowfan)
-		lowfan = info->fan1;
-	if (info->fan2 >= 0 && info->fan2 < lowfan)
-		lowfan = info->fan2;
-
-	tailsprintf(buf, "%2d/%3dC %04dR | ", info->temp0, info->temp2, lowfan);
-}
-
 /* We use a replacement algorithm to only remove references to work done from
  * the buffer when we need the extra space for new work. */
 static bool avalon_fill(struct cgpu_info *avalon)
@@ -965,6 +951,7 @@ static int64_t avalon_scanhash(struct thr_info *thr)
 
 	if (hash_count) {
 		record_temp_fan(info, &ar, &(avalon->temp));
+		avalon->temp = info->temp_max;
 		applog(LOG_INFO,
 		       "Avalon: Fan1: %d/m, Fan2: %d/m, Fan3: %d/m\t"
 		       "Temp1: %dC, Temp2: %dC, Temp3: %dC, TempMAX: %dC",
@@ -1032,7 +1019,6 @@ struct device_drv avalon_drv = {
 	.queue_full = avalon_fill,
 	.scanwork = avalon_scanhash,
 	.get_api_stats = avalon_api_stats,
-	.get_statline_before = get_avalon_statline_before,
 	.reinit_device = avalon_init,
 	.thread_shutdown = avalon_shutdown,
 };

+ 0 - 20
driver-bitforce.c

@@ -352,24 +352,6 @@ void bitforce_comm_error(struct thr_info *thr)
 	bitforce_clear_buffer(bitforce);
 }
 
-static void get_bitforce_statline_before(char *buf, struct cgpu_info *bitforce)
-{
-	struct bitforce_data *data = bitforce->device_data;
-	struct bitforce_proc_data *procdata = bitforce->thr[0]->cgpu_data;
-	
-	if (!procdata->handles_board)
-		goto nostats;
-
-	if (data->temp[0] > 0 && data->temp[1] > 0)
-		tailsprintf(buf, "%5.1fC/%4.1fC   | ", data->temp[0], data->temp[1]);
-	else
-	if (bitforce->temp > 0)
-		tailsprintf(buf, "%5.1fC         | ", bitforce->temp);
-	else
-nostats:
-		tailsprintf(buf, "               | ");
-}
-
 static bool bitforce_thread_prepare(struct thr_info *thr)
 {
 	struct cgpu_info *bitforce = thr->cgpu;
@@ -1435,7 +1417,6 @@ struct device_drv bitforce_drv = {
 	.get_api_stats = bitforce_drv_stats,
 	.minerloop = minerloop_async,
 	.reinit_device = bitforce_reinit,
-	.get_statline_before = get_bitforce_statline_before,
 	.get_stats = bitforce_get_stats,
 	.set_device = bitforce_set_device,
 	.identify_device = bitforce_identify,
@@ -1918,7 +1899,6 @@ struct device_drv bitforce_queue_api = {
 	.name = "BFL",
 	.minerloop = minerloop_queue,
 	.reinit_device = bitforce_reinit,
-	.get_statline_before = get_bitforce_statline_before,
 	.get_api_stats = bitforce_drv_stats,
 	.get_stats = bitforce_get_stats,
 	.set_device = bitforce_set_device,

+ 3 - 61
driver-modminer.c

@@ -456,73 +456,16 @@ modminer_fpga_init(struct thr_info *thr)
 }
 
 static
-bool get_modminer_upload_percent(char *buf, struct cgpu_info *modminer)
+bool get_modminer_upload_percent(char *buf, struct cgpu_info *modminer, __maybe_unused bool per_processor)
 {
-	char info[18] = "               | ";
-
 	char pdone = ((struct modminer_fpga_state*)(modminer->device->thr[0]->cgpu_data))->pdone;
 	if (pdone != 101) {
-		sprintf(&info[1], "%3d%%", pdone);
-		info[5] = ' ';
-		strcat(buf, info);
+		tailsprintf(buf, "%3d%% ", pdone);
 		return true;
 	}
 	return false;
 }
 
-static
-void get_modminer_statline_before(char *buf, struct cgpu_info *modminer)
-{
-	if (get_modminer_upload_percent(buf, modminer))
-		return;
-
-	struct thr_info*thr = modminer->thr[0];
-	struct modminer_fpga_state *state = thr->cgpu_data;
-	float gt = state->temp;
-	
-	if (gt > 0)
-		tailsprintf(buf, "%5.1fC ", gt);
-	else
-		tailsprintf(buf, "       ");
-	tailsprintf(buf, "        | ");
-}
-
-static
-void get_modminer_dev_statline_before(char *buf, struct cgpu_info *modminer)
-{
-	if (get_modminer_upload_percent(buf, modminer))
-		return;
-
-	char info[18] = "               | ";
-	int tc = modminer->procs;
-	bool havetemp = false;
-	int i;
-
-	if (tc > 4)
-		tc = 4;
-
-	for (i = 0; i < tc; ++i, modminer = modminer->next_proc) {
-		struct thr_info*thr = modminer->thr[0];
-		struct modminer_fpga_state *state = thr->cgpu_data;
-		unsigned char temp = state->temp;
-
-		info[i*3+2] = '/';
-		if (temp) {
-			havetemp = true;
-			if (temp > 9)
-				info[i*3+0] = 0x30 + (temp / 10);
-			info[i*3+1] = 0x30 + (temp % 10);
-		}
-	}
-	if (havetemp) {
-		info[tc*3-1] = ' ';
-		info[tc*3] = 'C';
-		strcat(buf, info);
-	}
-	else
-		strcat(buf, "               | ");
-}
-
 static void modminer_get_temperature(struct cgpu_info *modminer, struct thr_info *thr)
 {
 	struct modminer_fpga_state *state = thr->cgpu_data;
@@ -851,8 +794,7 @@ struct device_drv modminer_drv = {
 	.dname = "modminer",
 	.name = "MMQ",
 	.drv_detect = modminer_detect,
-	.get_dev_statline_before = get_modminer_dev_statline_before,
-	.get_statline_before = get_modminer_statline_before,
+	.override_statline_temp = get_modminer_upload_percent,
 	.get_stats = modminer_get_stats,
 	.get_api_extra_device_status = get_modminer_drv_extra_device_status,
 	.set_device = modminer_set_device,

+ 20 - 21
driver-opencl.c

@@ -853,6 +853,18 @@ void opencl_wlogprint_status(struct cgpu_info *cgpu)
 		float temp = 0, vddc = 0;
 
 		if (gpu_stats(cgpu->device_id, &temp, &engineclock, &memclock, &vddc, &activity, &fanspeed, &fanpercent, &powertune)) {
+			if (fanspeed != -1 || fanpercent != -1) {
+				tailsprintf(logline, "F: ");
+				if (fanpercent != -1)
+				{
+					tailsprintf(logline, "%d%% ", fanpercent);
+					if (fanspeed != -1)
+						tailsprintf(logline, "(%d RPM) ", fanspeed);
+				}
+				else
+					tailsprintf(logline, "%d RPM ", fanspeed);
+				tailsprintf(logline, " ");
+			}
 			if (engineclock != -1)
 				tailsprintf(logline, "E: %d MHz  ", engineclock);
 			if (memclock != -1)
@@ -1412,7 +1424,9 @@ static void reinit_opencl_device(struct cgpu_info *gpu)
 	tq_push(control_thr[gpur_thr_id].q, gpu);
 }
 
-static void get_opencl_statline_before(char *buf, struct cgpu_info *gpu)
+// FIXME: Legacy (called by TUI) for side effects
+static
+bool override_opencl_statline_temp(char *buf, struct cgpu_info *gpu, __maybe_unused bool per_processor)
 {
 #ifdef HAVE_SENSORS
 	struct opencl_device_data *data = gpu->device_data;
@@ -1433,33 +1447,18 @@ static void get_opencl_statline_before(char *buf, struct cgpu_info *gpu)
 				continue;
 			
 			gpu->temp = val;
-			tailsprintf(buf, "%5.1fC         | ", val);
-			return;
+			return false;
 		}
 	}
 #endif
 #ifdef HAVE_ADL
 	if (gpu->has_adl) {
 		int gpuid = gpu->device_id;
-		float gt = gpu_temp(gpuid);
-		int gf = gpu_fanspeed(gpuid);
-		int gp;
-
-		if (gt != -1)
-			tailsprintf(buf, "%5.1fC ", gt);
-		else
-			tailsprintf(buf, "       ");
-		if (gf != -1)
-			tailsprintf(buf, "%4dRPM ", gf);
-		else if ((gp = gpu_fanpercent(gpuid)) != -1)
-			tailsprintf(buf, "%3d%%    ", gp);
-		else
-			tailsprintf(buf, "        ");
-		tailsprintf(buf, "| ");
+		gpu_temp(gpuid);
+		gpu_fanspeed(gpuid);
 	}
-	else
 #endif
-		tailsprintf(buf, "               | ");
+	return false;
 }
 
 static struct api_data*
@@ -1762,7 +1761,7 @@ struct device_drv opencl_api = {
 	.name = "OCL",
 	.drv_detect = opencl_detect,
 	.reinit_device = reinit_opencl_device,
-	.get_statline_before = get_opencl_statline_before,
+	.override_statline_temp = override_opencl_statline_temp,
 #ifdef HAVE_CURSES
 	.proc_wlogprint_status = opencl_wlogprint_status,
 	.proc_tui_wlogprint_choices = opencl_tui_wlogprint_choices,

+ 3 - 45
driver-x6500.c

@@ -563,57 +563,16 @@ static bool x6500_get_stats(struct cgpu_info *x6500)
 }
 
 static
-bool get_x6500_upload_percent(char *buf, struct cgpu_info *x6500)
+bool get_x6500_upload_percent(char *buf, struct cgpu_info *x6500, __maybe_unused bool per_processor)
 {
-	char info[18] = "               | ";
-
 	unsigned char pdone = *((unsigned char*)x6500->device_data - 1);
 	if (pdone != 101) {
-		sprintf(&info[1], "%3d%%", pdone);
-		info[5] = ' ';
-		strcat(buf, info);
+		tailsprintf(buf, "%3d%% ", pdone);
 		return true;
 	}
 	return false;
 }
 
-static
-void get_x6500_statline_before(char *buf, struct cgpu_info *x6500)
-{
-	if (get_x6500_upload_percent(buf, x6500))
-		return;
-
-	char info[18] = "               | ";
-	struct x6500_fpga_data *fpga = x6500->thr[0]->cgpu_data;
-
-	if (fpga->temp) {
-		sprintf(&info[1], "%.1fC", fpga->temp);
-		info[strlen(info)] = ' ';
-		strcat(buf, info);
-		return;
-	}
-	strcat(buf, "               | ");
-}
-
-static
-void get_x6500_dev_statline_before(char *buf, struct cgpu_info *x6500)
-{
-	if (get_x6500_upload_percent(buf, x6500))
-		return;
-
-	char info[18] = "               | ";
-	struct x6500_fpga_data *fpga0 = x6500->thr[0]->cgpu_data;
-	struct x6500_fpga_data *fpga1 = x6500->next_proc->thr[0]->cgpu_data;
-
-	if (x6500->temp) {
-		sprintf(&info[1], "%.1fC/%.1fC", fpga0->temp, fpga1->temp);
-		info[strlen(info)] = ' ';
-		strcat(buf, info);
-		return;
-	}
-	strcat(buf, "               | ");
-}
-
 static struct api_data*
 get_x6500_api_extra_device_status(struct cgpu_info *x6500)
 {
@@ -788,11 +747,10 @@ struct device_drv x6500_api = {
 	.dname = "x6500",
 	.name = "XBS",
 	.drv_detect = x6500_detect,
-	.get_dev_statline_before = get_x6500_dev_statline_before,
 	.thread_prepare = x6500_prepare,
 	.thread_init = x6500_thread_init,
 	.get_stats = x6500_get_stats,
-	.get_statline_before = get_x6500_statline_before,
+	.override_statline_temp = get_x6500_upload_percent,
 	.get_api_extra_device_status = get_x6500_api_extra_device_status,
 	.poll = x6500_fpga_poll,
 	.minerloop = minerloop_async,

+ 0 - 14
driver-ztex.c

@@ -323,19 +323,6 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
 	return noncecnt;
 }
 
-static void ztex_statline_before(char *buf, struct cgpu_info *cgpu)
-{
-	char before[] = "               ";
-	if (cgpu->device_ztex) {
-		const char *snString = (char*)cgpu->device_ztex->snString;
-		size_t snStringLen = strlen(snString);
-		if (snStringLen > 14)
-			snStringLen = 14;
-		memcpy(before, snString, snStringLen);
-	}
-	tailsprintf(buf, "%s| ", &before[0]);
-}
-
 static struct api_data*
 get_ztex_drv_extra_device_status(struct cgpu_info *ztex)
 {
@@ -412,7 +399,6 @@ struct device_drv ztex_drv = {
 	.dname = "ztex",
 	.name = "ZTX",
 	.drv_detect = ztex_detect,
-	.get_statline_before = ztex_statline_before,
 	.get_api_extra_device_status = get_ztex_drv_extra_device_status,
 	.thread_init = ztex_prepare,
 	.scanhash = ztex_scanhash,

+ 6 - 19
miner.c

@@ -2451,7 +2451,6 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 	assert(for_curses == false);
 #endif
 	struct device_drv *drv = cgpu->drv;
-	void (*statline_func)(char *, struct cgpu_info *);
 	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 rejpcbuf[6];
@@ -2522,16 +2521,13 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 		return;
 	}
 	
-	if ((drv->get_dev_statline_before || drv->get_statline_before) && likely(drv_ready(cgpu)))
-	{
-		if (drv->get_dev_statline_before && drv->get_statline_before)
-			statline_func = opt_show_procs ? drv->get_statline_before : drv->get_dev_statline_before;
-		else
-			statline_func = drv->get_statline_before ?: drv->get_dev_statline_before;
-		statline_func(buf, cgpu);
-	}
+	if (likely(cgpu->status != LIFE_DEAD2) && drv->override_statline_temp && drv->override_statline_temp(buf, cgpu, opt_show_procs))
+		strcat(buf, " | ");
+	else
+	if (cgpu->temp > 0.)
+		tailsprintf(buf, "%4.1fC | ", cgpu->temp);
 	else
-		tailsprintf(buf, "               | ");
+		strcat(buf, "      | ");
 	
 #ifdef HAVE_CURSES
 	if (for_curses)
@@ -2604,15 +2600,6 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 			percentf2(badnonces, allnonces, bnbuf)
 		);
 	}
-	
-	if (drv->get_dev_statline_after || drv->get_statline)
-	{
-		if (drv->get_dev_statline_after && drv->get_statline)
-			statline_func = opt_show_procs ? drv->get_statline : drv->get_dev_statline_after;
-		else
-			statline_func = drv->get_statline ?: drv->get_dev_statline_after;
-		statline_func(buf, cgpu);
-	}
 }
 
 #define get_statline(buf, cgpu)               get_statline3(buf, cgpu, false, opt_show_procs)

+ 1 - 6
miner.h

@@ -284,14 +284,9 @@ struct device_drv {
 	// DRV-global functions
 	void (*drv_detect)();
 
-	// Device-specific functions
-	void (*get_dev_statline_before)(char *, struct cgpu_info *);
-	void (*get_dev_statline_after)(char *, struct cgpu_info *);
-
 	// Processor-specific functions
 	void (*reinit_device)(struct cgpu_info *);
-	void (*get_statline_before)(char *, struct cgpu_info *);
-	void (*get_statline)(char *, struct cgpu_info *);
+	bool (*override_statline_temp)(char *buf, struct cgpu_info *, bool per_processor);
 	struct api_data* (*get_api_extra_device_detail)(struct cgpu_info *);
 	struct api_data* (*get_api_extra_device_status)(struct cgpu_info *);
 	struct api_data *(*get_api_stats)(struct cgpu_info *);