|
|
@ -776,6 +776,7 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu |
|
|
|
case API_UTILITY: |
|
|
|
case API_UTILITY: |
|
|
|
case API_FREQ: |
|
|
|
case API_FREQ: |
|
|
|
case API_HS: |
|
|
|
case API_HS: |
|
|
|
|
|
|
|
case API_DIFF: |
|
|
|
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; |
|
|
@ -902,6 +903,11 @@ struct api_data *api_add_hs(struct api_data *root, char *name, double *data, boo |
|
|
|
return api_add_data_full(root, name, API_HS, (void *)data, copy_data); |
|
|
|
return api_add_data_full(root, name, API_HS, (void *)data, copy_data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct api_data *api_add_diff(struct api_data *root, char *name, double *data, bool copy_data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return api_add_data_full(root, name, API_DIFF, (void *)data, copy_data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static struct api_data *print_data(struct api_data *root, char *buf, bool isjson) |
|
|
|
static struct api_data *print_data(struct api_data *root, char *buf, bool isjson) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct api_data *tmp; |
|
|
|
struct api_data *tmp; |
|
|
@ -973,6 +979,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson |
|
|
|
case API_HS: |
|
|
|
case API_HS: |
|
|
|
sprintf(buf, "%.15f", *((double *)(root->data))); |
|
|
|
sprintf(buf, "%.15f", *((double *)(root->data))); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case API_DIFF: |
|
|
|
|
|
|
|
sprintf(buf, "%.8f", *((double *)(root->data))); |
|
|
|
|
|
|
|
break; |
|
|
|
case API_BOOL: |
|
|
|
case API_BOOL: |
|
|
|
sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR); |
|
|
|
sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1376,6 +1385,8 @@ static void gpustatus(int gpu, bool isjson) |
|
|
|
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false); |
|
|
|
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false); |
|
|
|
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false); |
|
|
|
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false); |
|
|
|
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
strcat(io_buffer, buf); |
|
|
|
strcat(io_buffer, buf); |
|
|
@ -1460,6 +1471,8 @@ static void pgastatus(int pga, bool isjson) |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false); |
|
|
|
root = api_add_freq(root, "Frequency", &frequency, false); |
|
|
|
root = api_add_freq(root, "Frequency", &frequency, false); |
|
|
|
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false); |
|
|
|
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false); |
|
|
|
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
strcat(io_buffer, buf); |
|
|
|
strcat(io_buffer, buf); |
|
|
@ -1493,6 +1506,8 @@ static void cpustatus(int cpu, bool isjson) |
|
|
|
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false); |
|
|
|
root = api_add_time(root, "Last Share Time", &(cgpu->last_share_pool_time), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(cgpu->total_mhashes), false); |
|
|
|
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false); |
|
|
|
root = api_add_int(root, "Diff1 Work", &(cgpu->diff1), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false); |
|
|
|
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
strcat(io_buffer, buf); |
|
|
|
strcat(io_buffer, buf); |
|
|
@ -1872,6 +1887,9 @@ static void poolstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, |
|
|
|
root = api_add_const(root, "Proxy Type", BLANK, false); |
|
|
|
root = api_add_const(root, "Proxy Type", BLANK, false); |
|
|
|
root = api_add_const(root, "Proxy", BLANK, false); |
|
|
|
root = api_add_const(root, "Proxy", BLANK, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Accepted", &(pool->diff_accepted), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(pool->diff_rejected), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Stale", &(pool->diff_stale), false); |
|
|
|
|
|
|
|
|
|
|
|
if (isjson && (i > 0)) |
|
|
|
if (isjson && (i > 0)) |
|
|
|
strcat(io_buffer, COMMA); |
|
|
|
strcat(io_buffer, COMMA); |
|
|
@ -1924,6 +1942,9 @@ static void summary(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, boo |
|
|
|
root = api_add_uint(root, "Network Blocks", &(new_blocks), false); |
|
|
|
root = api_add_uint(root, "Network Blocks", &(new_blocks), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(total_mhashes_done), false); |
|
|
|
root = api_add_mhtotal(root, "Total MH", &(total_mhashes_done), false); |
|
|
|
root = api_add_utility(root, "Work Utility", &(work_utility), false); |
|
|
|
root = api_add_utility(root, "Work Utility", &(work_utility), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Accepted", &(total_diff_accepted), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Rejected", &(total_diff_rejected), false); |
|
|
|
|
|
|
|
root = api_add_diff(root, "Difficulty Stale", &(total_diff_stale), false); |
|
|
|
|
|
|
|
|
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
root = print_data(root, buf, isjson); |
|
|
|
if (isjson) |
|
|
|
if (isjson) |
|
|
|