Browse Source

Merge branch 'api'

nfactor-troky
Kano 12 years ago
parent
commit
1ce817d4df
  1. 9
      API-README
  2. 3
      api.c
  3. 18
      cgminer.c
  4. 1
      miner.h

9
API-README

@ -400,7 +400,14 @@ miner.php - an example web page to access the API
Feature Changelog for external applications using the API: Feature Changelog for external applications using the API:
API V1.23 API V1.24
Modified API commands:
'pools' - add 'Best Share'
----------
API V1.23 (cgminer v2.10.2)
Added API commands: Added API commands:
'pgaset' - with: MMQ opt=clock val=160 to 230 (and a multiple of 2) 'pgaset' - with: MMQ opt=clock val=160 to 230 (and a multiple of 2)

3
api.c

@ -133,7 +133,7 @@ static const char SEPARATOR = '|';
#define SEPSTR "|" #define SEPSTR "|"
static const char GPUSEP = ','; static const char GPUSEP = ',';
static const char *APIVERSION = "1.23"; static const char *APIVERSION = "1.24";
static const char *DEAD = "Dead"; static const char *DEAD = "Dead";
#if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA) #if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA)
static const char *SICK = "Sick"; static const char *SICK = "Sick";
@ -1993,6 +1993,7 @@ static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __m
else else
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 = 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);

18
cgminer.c

@ -2349,6 +2349,8 @@ static uint64_t share_diff(const struct work *work)
best_diff = ret; best_diff = ret;
suffix_string(best_diff, best_share, 0); suffix_string(best_diff, best_share, 0);
} }
if (ret > work->pool->best_diff)
work->pool->best_diff = ret;
mutex_unlock(&control_lock); mutex_unlock(&control_lock);
return ret; return ret;
} }
@ -3933,6 +3935,10 @@ void zero_stats(void)
total_diff1 = 0; total_diff1 = 0;
memset(best_share, 0, 8); memset(best_share, 0, 8);
suffix_string(best_diff, best_share, 0); suffix_string(best_diff, best_share, 0);
found_blocks = 0;
total_diff_accepted = 0;
total_diff_rejected = 0;
total_diff_stale = 0;
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
struct pool *pool = pools[i]; struct pool *pool = pools[i];
@ -3944,6 +3950,13 @@ void zero_stats(void)
pool->discarded_work = 0; pool->discarded_work = 0;
pool->getfail_occasions = 0; pool->getfail_occasions = 0;
pool->remotefail_occasions = 0; pool->remotefail_occasions = 0;
pool->last_share_time = 0;
pool->diff1 = 0;
pool->diff_accepted = 0;
pool->diff_rejected = 0;
pool->diff_stale = 0;
pool->last_share_diff = 0;
pool->best_diff = 0;
} }
mutex_lock(&hash_lock); mutex_lock(&hash_lock);
@ -3955,6 +3968,11 @@ void zero_stats(void)
cgpu->rejected = 0; cgpu->rejected = 0;
cgpu->hw_errors = 0; cgpu->hw_errors = 0;
cgpu->utility = 0.0; cgpu->utility = 0.0;
cgpu->last_share_pool_time = 0;
cgpu->diff1 = 0;
cgpu->diff_accepted = 0;
cgpu->diff_rejected = 0;
cgpu->last_share_diff = 0;
} }
mutex_unlock(&hash_lock); mutex_unlock(&hash_lock);
} }

1
miner.h

@ -924,6 +924,7 @@ struct pool {
time_t last_share_time; time_t last_share_time;
double last_share_diff; double last_share_diff;
uint64_t best_diff;
struct cgminer_stats cgminer_stats; struct cgminer_stats cgminer_stats;
struct cgminer_pool_stats cgminer_pool_stats; struct cgminer_pool_stats cgminer_pool_stats;

Loading…
Cancel
Save