Browse Source

Add average wait time to api stats

nfactor-troky
Paul Sheppard 12 years ago
parent
commit
2c54522d7d
  1. 7
      driver-bitforce.c
  2. 3
      miner.h

7
driver-bitforce.c

@ -29,6 +29,7 @@
#define WORK_CHECK_INTERVAL_MS 50 #define WORK_CHECK_INTERVAL_MS 50
#define MAX_START_DELAY_US 100000 #define MAX_START_DELAY_US 100000
#define tv_to_ms(tval) (tval.tv_sec * 1000 + tval.tv_usec / 1000) #define tv_to_ms(tval) (tval.tv_sec * 1000 + tval.tv_usec / 1000)
#define TIME_AVE_CONSTANT 8
struct device_api bitforce_api; struct device_api bitforce_api;
@ -407,6 +408,10 @@ static uint64_t bitforce_get_result(struct thr_info *thr, struct work *work)
if (delay_time_ms != bitforce->sleep_ms) if (delay_time_ms != bitforce->sleep_ms)
applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms); applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms);
/* Work out the average time taken. Float for calculation, uint for display */
bitforce->ave_wait_f += (tv_to_ms(elapsed) - bitforce->ave_wait_f) / TIME_AVE_CONSTANT;
bitforce->ave_wait_d = (unsigned int) (bitforce->ave_wait_f + 0.5);
} }
applog(LOG_DEBUG, "BFL%i: waited %dms until %s", bitforce->device_id, bitforce->wait_ms, pdevbuf); applog(LOG_DEBUG, "BFL%i: waited %dms until %s", bitforce->device_id, bitforce->wait_ms, pdevbuf);
@ -432,7 +437,6 @@ static uint64_t bitforce_get_result(struct thr_info *thr, struct work *work)
bitforce->nonce_range = false; bitforce->nonce_range = false;
work->blk.nonce = 0xffffffff; work->blk.nonce = 0xffffffff;
bitforce->sleep_ms *= 5; bitforce->sleep_ms *= 5;
bitforce->kname = "Single";
} }
submit_nonce(thr, work, nonce); submit_nonce(thr, work, nonce);
@ -520,6 +524,7 @@ static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
// locking access to displaying API debug 'stats' // locking access to displaying API debug 'stats'
// If locking becomes an issue for any of them, use copy_data=true also // If locking becomes an issue for any of them, use copy_data=true also
root = api_add_uint(root, "Sleep Time", &(cgpu->sleep_ms), false); root = api_add_uint(root, "Sleep Time", &(cgpu->sleep_ms), false);
root = api_add_uint(root, "Ave Wait", &(cgpu->ave_wait_d), false);
return root; return root;
} }

3
miner.h

@ -321,8 +321,11 @@ struct cgpu_info {
}; };
#ifdef USE_BITFORCE #ifdef USE_BITFORCE
struct timeval work_start_tv; struct timeval work_start_tv;
unsigned int ave_wait;
unsigned int wait_ms; unsigned int wait_ms;
unsigned int sleep_ms; unsigned int sleep_ms;
double ave_wait_f;
unsigned int ave_wait_d;
uint32_t nonces; uint32_t nonces;
bool nonce_range; bool nonce_range;
#endif #endif

Loading…
Cancel
Save