|
@@ -134,7 +134,7 @@ static const char SEPARATOR = '|';
|
|
|
#define SEPSTR "|"
|
|
#define SEPSTR "|"
|
|
|
static const char GPUSEP = ',';
|
|
static const char GPUSEP = ',';
|
|
|
|
|
|
|
|
-static const char *APIVERSION = "1.27";
|
|
|
|
|
|
|
+static const char *APIVERSION = "1.28";
|
|
|
static const char *DEAD = "Dead";
|
|
static const char *DEAD = "Dead";
|
|
|
#if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA) || defined(HAVE_AN_ASIC)
|
|
#if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA) || defined(HAVE_AN_ASIC)
|
|
|
static const char *SICK = "Sick";
|
|
static const char *SICK = "Sick";
|
|
@@ -938,6 +938,7 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
|
|
|
case API_FREQ:
|
|
case API_FREQ:
|
|
|
case API_HS:
|
|
case API_HS:
|
|
|
case API_DIFF:
|
|
case API_DIFF:
|
|
|
|
|
+ case API_PERCENT:
|
|
|
api_data->data = (void *)malloc(sizeof(double));
|
|
api_data->data = (void *)malloc(sizeof(double));
|
|
|
*((double *)(api_data->data)) = *((double *)data);
|
|
*((double *)(api_data->data)) = *((double *)data);
|
|
|
break;
|
|
break;
|
|
@@ -1069,6 +1070,11 @@ struct api_data *api_add_diff(struct api_data *root, char *name, double *data, b
|
|
|
return api_add_data_full(root, name, API_DIFF, (void *)data, copy_data);
|
|
return api_add_data_full(root, name, API_DIFF, (void *)data, copy_data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+struct api_data *api_add_percent(struct api_data *root, char *name, double *data, bool copy_data)
|
|
|
|
|
+{
|
|
|
|
|
+ return api_add_data_full(root, name, API_PERCENT, (void *)data, copy_data);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static struct api_data *print_data(struct api_data *root, char *buf, bool isjson, bool precom)
|
|
static struct api_data *print_data(struct api_data *root, char *buf, bool isjson, bool precom)
|
|
|
{
|
|
{
|
|
|
struct api_data *tmp;
|
|
struct api_data *tmp;
|
|
@@ -1161,6 +1167,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
|
|
|
case API_TEMP:
|
|
case API_TEMP:
|
|
|
sprintf(buf, "%.2f", *((float *)(root->data)));
|
|
sprintf(buf, "%.2f", *((float *)(root->data)));
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case API_PERCENT:
|
|
|
|
|
+ sprintf(buf, "%.4f", *((double *)(root->data)) * 100.0);
|
|
|
|
|
+ break;
|
|
|
default:
|
|
default:
|
|
|
applog(LOG_ERR, "API: unknown2 data type %d ignored", root->type);
|
|
applog(LOG_ERR, "API: unknown2 data type %d ignored", root->type);
|
|
|
sprintf(buf, "%s%s%s", quote, UNKNOWN, quote);
|
|
sprintf(buf, "%s%s%s", quote, UNKNOWN, quote);
|
|
@@ -1618,6 +1627,12 @@ static void gpustatus(struct io_data *io_data, int gpu, bool isjson, bool precom
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
|
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
|
|
|
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
|
|
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
|
|
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
|
|
|
|
+ double hwp = (cgpu->hw_errors + cgpu->diff1) ?
|
|
|
|
|
+ (double)(cgpu->hw_errors) / (double)(cgpu->hw_errors + cgpu->diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Hardware%", &hwp, false);
|
|
|
|
|
+ double rejp = cgpu->diff1 ?
|
|
|
|
|
+ (double)(cgpu->diff_rejected) / (double)(cgpu->diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Rejected%", &rejp, false);
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson, precom);
|
|
root = print_data(root, buf, isjson, precom);
|
|
|
io_add(io_data, buf);
|
|
io_add(io_data, buf);
|
|
@@ -1691,6 +1706,12 @@ static void ascstatus(struct io_data *io_data, int asc, bool isjson, bool precom
|
|
|
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
|
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
|
|
#endif
|
|
#endif
|
|
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
|
|
|
|
+ double hwp = (cgpu->hw_errors + cgpu->diff1) ?
|
|
|
|
|
+ (double)(cgpu->hw_errors) / (double)(cgpu->hw_errors + cgpu->diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Hardware%", &hwp, false);
|
|
|
|
|
+ double rejp = cgpu->diff1 ?
|
|
|
|
|
+ (double)(cgpu->diff_rejected) / (double)(cgpu->diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Rejected%", &rejp, false);
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson, precom);
|
|
root = print_data(root, buf, isjson, precom);
|
|
|
io_add(io_data, buf);
|
|
io_add(io_data, buf);
|
|
@@ -1775,6 +1796,12 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom
|
|
|
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
|
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
|
|
#endif
|
|
#endif
|
|
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
|
|
|
|
+ double hwp = (cgpu->hw_errors + cgpu->diff1) ?
|
|
|
|
|
+ (double)(cgpu->hw_errors) / (double)(cgpu->hw_errors + cgpu->diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Hardware%", &hwp, false);
|
|
|
|
|
+ double rejp = cgpu->diff1 ?
|
|
|
|
|
+ (double)(cgpu->diff_rejected) / (double)(cgpu->diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Rejected%", &rejp, false);
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson, precom);
|
|
root = print_data(root, buf, isjson, precom);
|
|
|
io_add(io_data, buf);
|
|
io_add(io_data, buf);
|
|
@@ -2145,6 +2172,12 @@ static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
|
|
|
root = api_add_const(root, "Stratum URL", BLANK, false);
|
|
root = api_add_const(root, "Stratum URL", BLANK, false);
|
|
|
root = api_add_bool(root, "Has GBT", &(pool->has_gbt), false);
|
|
root = api_add_bool(root, "Has GBT", &(pool->has_gbt), false);
|
|
|
root = api_add_uint64(root, "Best Share", &(pool->best_diff), true);
|
|
root = api_add_uint64(root, "Best Share", &(pool->best_diff), true);
|
|
|
|
|
+ double rejp = (pool->diff_accepted + pool->diff_rejected + pool->diff_stale) ?
|
|
|
|
|
+ (double)(pool->diff_rejected) / (double)(pool->diff_accepted + pool->diff_rejected + pool->diff_stale) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Pool Rejected%", &rejp, false);
|
|
|
|
|
+ double stalep = (pool->diff_accepted + pool->diff_rejected + pool->diff_stale) ?
|
|
|
|
|
+ (double)(pool->diff_stale) / (double)(pool->diff_accepted + pool->diff_rejected + pool->diff_stale) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Pool Stale%", &stalep, false);
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson, isjson && (i > 0));
|
|
root = print_data(root, buf, isjson, isjson && (i > 0));
|
|
|
io_add(io_data, buf);
|
|
io_add(io_data, buf);
|
|
@@ -2191,6 +2224,18 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(total_diff_rejected), true);
|
|
root = api_add_diff(root, "Difficulty Rejected", &(total_diff_rejected), true);
|
|
|
root = api_add_diff(root, "Difficulty Stale", &(total_diff_stale), true);
|
|
root = api_add_diff(root, "Difficulty Stale", &(total_diff_stale), true);
|
|
|
root = api_add_uint64(root, "Best Share", &(best_diff), true);
|
|
root = api_add_uint64(root, "Best Share", &(best_diff), true);
|
|
|
|
|
+ double hwp = (hw_errors + total_diff1) ?
|
|
|
|
|
+ (double)(hw_errors) / (double)(hw_errors + total_diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Hardware%", &hwp, false);
|
|
|
|
|
+ double rejp = total_diff1 ?
|
|
|
|
|
+ (double)(total_diff_rejected) / (double)(total_diff1) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Device Rejected%", &rejp, false);
|
|
|
|
|
+ double prejp = (total_diff_accepted + total_diff_rejected + total_diff_stale) ?
|
|
|
|
|
+ (double)(total_diff_rejected) / (double)(total_diff_accepted + total_diff_rejected + total_diff_stale) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Pool Rejected%", &prejp, false);
|
|
|
|
|
+ double stalep = (total_diff_accepted + total_diff_rejected + total_diff_stale) ?
|
|
|
|
|
+ (double)(total_diff_stale) / (double)(total_diff_accepted + total_diff_rejected + total_diff_stale) : 0;
|
|
|
|
|
+ root = api_add_percent(root, "Pool Stale%", &stalep, false);
|
|
|
|
|
|
|
|
mutex_unlock(&hash_lock);
|
|
mutex_unlock(&hash_lock);
|
|
|
|
|
|