mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
modminer: Temperature sensor improvements
Display the temperature of each of the (up to) 4 FPGAs
This commit is contained in:
parent
9f872d1de6
commit
a78d616bc5
@ -4318,7 +4318,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
|
|||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
for (i = 0; i < total_devices; ++i) {
|
for (i = 0; i < total_devices; ++i) {
|
||||||
struct cgpu_info *cgpu = devices[i];
|
struct cgpu_info *cgpu = devices[i];
|
||||||
struct thr_info *thr = cgpu->thread;
|
struct thr_info *thr = cgpu->thr[0];
|
||||||
enum dev_enable *denable;
|
enum dev_enable *denable;
|
||||||
int gpu;
|
int gpu;
|
||||||
|
|
||||||
@ -5200,6 +5200,8 @@ begin_bench:
|
|||||||
k = 0;
|
k = 0;
|
||||||
for (i = 0; i < total_devices; ++i) {
|
for (i = 0; i < total_devices; ++i) {
|
||||||
struct cgpu_info *cgpu = devices[i];
|
struct cgpu_info *cgpu = devices[i];
|
||||||
|
cgpu->thr = malloc(sizeof(*cgpu->thr) * (cgpu->threads+1));
|
||||||
|
cgpu->thr[cgpu->threads] = NULL;
|
||||||
|
|
||||||
for (j = 0; j < cgpu->threads; ++j, ++k) {
|
for (j = 0; j < cgpu->threads; ++j, ++k) {
|
||||||
thr = &thr_info[k];
|
thr = &thr_info[k];
|
||||||
@ -5227,7 +5229,7 @@ begin_bench:
|
|||||||
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
|
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
|
||||||
quit(1, "thread %d create failed", thr->id);
|
quit(1, "thread %d create failed", thr->id);
|
||||||
|
|
||||||
cgpu->thread = thr;
|
cgpu->thr[j] = thr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,17 +106,6 @@ modminer_detect()
|
|||||||
serial_detect_auto("modminer", modminer_detect_one, modminer_detect_auto);
|
serial_detect_auto("modminer", modminer_detect_one, modminer_detect_auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
get_modminer_statline_before(char *buf, struct cgpu_info *modminer)
|
|
||||||
{
|
|
||||||
float gt = modminer->temp;
|
|
||||||
if (gt > 0)
|
|
||||||
tailsprintf(buf, "%5.1fC ", gt);
|
|
||||||
else
|
|
||||||
tailsprintf(buf, " ", gt);
|
|
||||||
tailsprintf(buf, " | ");
|
|
||||||
}
|
|
||||||
|
|
||||||
#define bailout(...) return _bailout(-1, modminer, __VA_ARGS__);
|
#define bailout(...) return _bailout(-1, modminer, __VA_ARGS__);
|
||||||
#define bailout2(...) return _bailout(fd, modminer, __VA_ARGS__);
|
#define bailout2(...) return _bailout(fd, modminer, __VA_ARGS__);
|
||||||
|
|
||||||
@ -255,6 +244,8 @@ struct modminer_fpga_state {
|
|||||||
int no_nonce_counter;
|
int no_nonce_counter;
|
||||||
int good_share_counter;
|
int good_share_counter;
|
||||||
time_t last_cutoff_reduced;
|
time_t last_cutoff_reduced;
|
||||||
|
|
||||||
|
unsigned char temp;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -346,6 +337,39 @@ modminer_fpga_init(struct thr_info *thr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_modminer_statline_before(char *buf, struct cgpu_info *modminer)
|
||||||
|
{
|
||||||
|
char info[18] = " | ";
|
||||||
|
int tc = modminer->threads;
|
||||||
|
bool havetemp = false;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (tc > 4)
|
||||||
|
tc = 4;
|
||||||
|
|
||||||
|
for (i = tc - 1; i >= 0; --i) {
|
||||||
|
struct thr_info*thr = modminer->thr[i];
|
||||||
|
struct modminer_fpga_state *state = thr->cgpu_data;
|
||||||
|
unsigned char temp = state->temp;
|
||||||
|
|
||||||
|
info[i*3+2] = '/';
|
||||||
|
if (temp) {
|
||||||
|
havetemp = true;
|
||||||
|
if (temp > 9)
|
||||||
|
info[i*3+0] = 0x30 + (temp / 10);
|
||||||
|
info[i*3+1] = 0x30 + (temp % 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (havetemp) {
|
||||||
|
info[tc*3-1] = ' ';
|
||||||
|
info[tc*3] = 'C';
|
||||||
|
strcat(buf, info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcat(buf, " | ");
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
modminer_prepare_next_work(struct modminer_fpga_state*state, struct work*work)
|
modminer_prepare_next_work(struct modminer_fpga_state*state, struct work*work)
|
||||||
{
|
{
|
||||||
@ -401,7 +425,9 @@ modminer_process_results(struct thr_info*thr)
|
|||||||
mutex_lock(&modminer->device_mutex);
|
mutex_lock(&modminer->device_mutex);
|
||||||
if (2 == write(fd, cmd, 2) && read(fd, &temperature, 1) == 1)
|
if (2 == write(fd, cmd, 2) && read(fd, &temperature, 1) == 1)
|
||||||
{
|
{
|
||||||
modminer->temp = (float)temperature;
|
state->temp = temperature;
|
||||||
|
if (!fpgaid)
|
||||||
|
modminer->temp = (float)temperature;
|
||||||
if (temperature > modminer->cutofftemp - 2) {
|
if (temperature > modminer->cutofftemp - 2) {
|
||||||
if (temperature > modminer->cutofftemp) {
|
if (temperature > modminer->cutofftemp) {
|
||||||
applog(LOG_WARNING, "%s %u.%u: Hit thermal cutoff limit, disabling device!", modminer->api->name, modminer->device_id, fpgaid);
|
applog(LOG_WARNING, "%s %u.%u: Hit thermal cutoff limit, disabling device!", modminer->api->name, modminer->device_id, fpgaid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user