Commit c4870676c45277adc926a889f208b3b80bb49f64

Paul Sheppard 2012-07-03T10:40:02

Add api stats (sleep time)

diff --git a/driver-bitforce.c b/driver-bitforce.c
index 5d89028..27494c4 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -442,10 +442,24 @@ static bool bitforce_thread_init(struct thr_info *thr)
 	return true;
 }
 
+static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
+{
+	struct api_data *root = NULL;
+
+	// Warning, access to these is not locked - but we don't really
+	// care since hashing performance is way more important than
+	// locking access to displaying API debug 'stats'
+	// If locking becomes an issue for any of them, use copy_data=true also
+	root = api_add_int(root, "Sleep Time", &(cgpu->sleep_ms), false);
+
+	return root;
+}
+
 struct device_api bitforce_api = {
 	.dname = "bitforce",
 	.name = "BFL",
 	.api_detect = bitforce_detect,
+	.get_api_stats = bitforce_api_stats,
 	.reinit_device = bitforce_init,
 	.get_statline_before = get_bitforce_statline_before,
 	.get_stats = bitforce_get_stats,