Browse Source

A driver can supply its own rolling hashrate function
(in case generic rolling hashrate implementation does not work)

Vitalii Demianets 11 years ago
parent
commit
ffbd0ae8d6
3 changed files with 8 additions and 1 deletions
  1. 3 0
      api.c
  2. 4 1
      miner.c
  3. 1 0
      miner.h

+ 3 - 0
api.c

@@ -1512,6 +1512,9 @@ void devstatus_an(struct io_data *io_data, struct cgpu_info *cgpu, bool isjson,
 			break;
 	}
 
+	if ((!per_proc) && (cgpu->device == cgpu) && (cgpu->drv->get_master_rolling_hashrate))
+		rolling = cgpu->drv->get_master_rolling_hashrate(cgpu);
+
 	root = api_add_int(root, "PGA", &n, true);
 	root = api_add_device_identifier(root, cgpu);
 	root = api_add_string(root, "Enabled", bool2str(enabled), false);

+ 4 - 1
miner.c

@@ -3891,7 +3891,10 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 				break;
 		}
 	}
-	
+
+	if ((cgpu->device == cgpu) && (drv->get_master_rolling_hashrate))
+		rolling = drv->get_master_rolling_hashrate(cgpu);
+
 	double wtotal = (waccepted + wnotaccepted);
 	
 	multi_format_unit_array2(

+ 1 - 0
miner.h

@@ -321,6 +321,7 @@ struct device_drv {
 	void (*proc_tui_wlogprint_choices)(struct cgpu_info *);
 	const char *(*proc_tui_handle_choice)(struct cgpu_info *, int input);
 	void (*zero_stats)(struct cgpu_info *);
+	double (*get_master_rolling_hashrate)(struct cgpu_info *);
 
 	// Thread-specific functions
 	bool (*thread_prepare)(struct thr_info *);