Browse Source

Added idle mode

Idle is only set by pgadisable, so GPU/CPU is unaffected.
For Icarus/Ztex, in scanhash the thread is immediately set disabled then returns.
nfactor-troky
Paul Sheppard 13 years ago
parent
commit
ebeaf15f18
  1. 11
      api.c
  2. 23
      cgminer.c
  3. 6
      driver-icarus.c
  4. 6
      driver-ztex.c
  5. 1
      miner.h

11
api.c

@ -167,6 +167,7 @@ static const char *SICK = "Sick"; @@ -167,6 +167,7 @@ static const char *SICK = "Sick";
static const char *NOSTART = "NoStart";
static const char *DISABLED = "Disabled";
static const char *ALIVE = "Alive";
static const char *IDLE = "Idle";
static const char *REJECTING = "Rejecting";
static const char *UNKNOWN = "Unknown";
#define _DYNAMIC "D"
@ -879,7 +880,7 @@ static void pgastatus(int pga, bool isjson) @@ -879,7 +880,7 @@ static void pgastatus(int pga, bool isjson)
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
if (cgpu->deven != DEV_DISABLED)
if (cgpu->deven == DEV_ENABLED)
enabled = (char *)YES;
else
enabled = (char *)NO;
@ -890,6 +891,8 @@ static void pgastatus(int pga, bool isjson) @@ -890,6 +891,8 @@ static void pgastatus(int pga, bool isjson)
status = (char *)SICK;
else if (cgpu->status == LIFE_NOSTART)
status = (char *)NOSTART;
else if (cgpu->deven == DEV_IDLE)
status = (char *)IDLE;
else
status = (char *)ALIVE;
@ -1092,7 +1095,7 @@ static void pgaenable(__maybe_unused SOCKETTYPE c, char *param, bool isjson) @@ -1092,7 +1095,7 @@ static void pgaenable(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
struct cgpu_info *cgpu = devices[dev];
if (cgpu->deven != DEV_DISABLED) {
if (cgpu->deven == DEV_ENABLED) {
strcpy(io_buffer, message(MSG_PGALRENA, id, NULL, isjson));
return;
}
@ -1143,12 +1146,12 @@ static void pgadisable(__maybe_unused SOCKETTYPE c, char *param, bool isjson) @@ -1143,12 +1146,12 @@ static void pgadisable(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
struct cgpu_info *cgpu = devices[dev];
if (cgpu->deven == DEV_DISABLED) {
if (cgpu->deven != DEV_ENABLED) {
strcpy(io_buffer, message(MSG_PGALRDIS, id, NULL, isjson));
return;
}
cgpu->deven = DEV_DISABLED;
cgpu->deven = DEV_IDLE;
strcpy(io_buffer, message(MSG_PGADIS, id, NULL, isjson));
}

23
cgminer.c

@ -2643,22 +2643,15 @@ void remove_pool(struct pool *pool) @@ -2643,22 +2643,15 @@ void remove_pool(struct pool *pool)
void write_config(FILE *fcfg)
{
int i = 0;
int j = 0;
int i;
/* Write pool values in priority order */
/* Write pool values */
fputs("{\n\"pools\" : [", fcfg);
while((j < total_pools) && (i < total_pools)) {
if(pools[i]->prio == j) {
fprintf(fcfg, "%s\n\t{\n\t\t\"url\" : \"%s\",", i > 0 ? "," : "", pools[i]->rpc_url);
fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", pools[i]->rpc_user);
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", pools[i]->rpc_pass);
j++;
i=0;
}
else
i++;
}
for(i = 0; i < total_pools; i++) {
fprintf(fcfg, "%s\n\t{\n\t\t\"url\" : \"%s\",", i > 0 ? "," : "", pools[i]->rpc_url);
fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", pools[i]->rpc_user);
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", pools[i]->rpc_pass);
}
fputs("\n]\n", fcfg);
if (nDevs) {
@ -3925,7 +3918,7 @@ void *miner_thread(void *userdata) @@ -3925,7 +3918,7 @@ void *miner_thread(void *userdata)
tv_lastupdate = tv_end;
}
if (unlikely(mythr->pause || cgpu->deven != DEV_ENABLED)) {
if (unlikely(mythr->pause || cgpu->deven == DEV_DISABLED || cgpu->deven == DEV_RECOVER)) {
applog(LOG_WARNING, "Thread %d being disabled", thr_id);
disabled:
mythr->rolling = mythr->cgpu->rolling = 0;

6
driver-icarus.c

@ -566,6 +566,12 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work, @@ -566,6 +566,12 @@ static uint64_t icarus_scanhash(struct thr_info *thr, struct work *work,
uint32_t values;
uint64_t hash_count_range;
/* Device developer can make use of idle state, until then, disable and return */
if (thr->cgpu->deven == DEV_IDLE) {
thr->cgpu->deven = DEV_DISABLED;
return 1;
}
elapsed.tv_sec = elapsed.tv_usec = 0;
icarus = thr->cgpu;

6
driver-ztex.c

@ -199,6 +199,12 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work, @@ -199,6 +199,12 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
bool overflow, found, rv;
struct libztex_hash_data hdata[GOLDEN_BACKLOG];
/* Device developer can make use of idle state, until then, disable and return */
if (thr->cgpu->deven == DEV_IDLE) {
thr->cgpu->deven = DEV_DISABLED;
return 1;
}
ztex = thr->cgpu->device_ztex;
memcpy(sendbuf, work->data + 64, 12);

1
miner.h

@ -250,6 +250,7 @@ enum dev_enable { @@ -250,6 +250,7 @@ enum dev_enable {
DEV_ENABLED,
DEV_DISABLED,
DEV_RECOVER,
DEV_IDLE,
};
enum cl_kernels {

Loading…
Cancel
Save