mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +00:00
Move intensity range values into miner.h
This commit is contained in:
parent
a992b5d89d
commit
63e31b4d78
4
api.c
4
api.c
@ -322,7 +322,7 @@ struct CODES {
|
|||||||
{ SEVERITY_ERR, MSG_MISVAL, PARAM_NONE, "Missing comma after GPU number" },
|
{ SEVERITY_ERR, MSG_MISVAL, PARAM_NONE, "Missing comma after GPU number" },
|
||||||
{ SEVERITY_ERR, MSG_NOADL, PARAM_NONE, "ADL is not available" },
|
{ SEVERITY_ERR, MSG_NOADL, PARAM_NONE, "ADL is not available" },
|
||||||
{ SEVERITY_ERR, MSG_NOGPUADL,PARAM_GPU, "GPU %d does not have ADL" },
|
{ SEVERITY_ERR, MSG_NOGPUADL,PARAM_GPU, "GPU %d does not have ADL" },
|
||||||
{ SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range -10 - 10" },
|
{ SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " _MIN_INTENSITY_STR " - " _MAX_INTENSITY_STR },
|
||||||
{ SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" },
|
{ SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" },
|
||||||
{ SEVERITY_SUCC, MSG_MINECON, PARAM_NONE, "CGMiner config" },
|
{ SEVERITY_SUCC, MSG_MINECON, PARAM_NONE, "CGMiner config" },
|
||||||
{ SEVERITY_ERR, MSG_GPUMERR, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported failure" },
|
{ SEVERITY_ERR, MSG_GPUMERR, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported failure" },
|
||||||
@ -999,7 +999,7 @@ static void gpuintensity(SOCKETTYPE c, char *param, bool isjson)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
intensity = atoi(value);
|
intensity = atoi(value);
|
||||||
if (intensity < -10 || intensity > 10) {
|
if (intensity < MIN_INTENSITY || intensity > MAX_INTENSITY) {
|
||||||
strcpy(io_buffer, message(MSG_INVINT, 0, value, isjson));
|
strcpy(io_buffer, message(MSG_INVINT, 0, value, isjson));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
14
main.c
14
main.c
@ -1452,7 +1452,7 @@ static char *set_intensity(char *arg)
|
|||||||
else {
|
else {
|
||||||
gpus[device].dynamic = false;
|
gpus[device].dynamic = false;
|
||||||
val = atoi(nextptr);
|
val = atoi(nextptr);
|
||||||
if (val < -10 || val > 14)
|
if (val < MIN_INTENSITY || val > MAX_INTENSITY)
|
||||||
return "Invalid value passed to set intensity";
|
return "Invalid value passed to set intensity";
|
||||||
tt = &gpus[device].intensity;
|
tt = &gpus[device].intensity;
|
||||||
*tt = val;
|
*tt = val;
|
||||||
@ -1466,7 +1466,7 @@ static char *set_intensity(char *arg)
|
|||||||
else {
|
else {
|
||||||
gpus[device].dynamic = false;
|
gpus[device].dynamic = false;
|
||||||
val = atoi(nextptr);
|
val = atoi(nextptr);
|
||||||
if (val < -10 || val > 14)
|
if (val < MIN_INTENSITY || val > MAX_INTENSITY)
|
||||||
return "Invalid value passed to set intensity";
|
return "Invalid value passed to set intensity";
|
||||||
|
|
||||||
tt = &gpus[device].intensity;
|
tt = &gpus[device].intensity;
|
||||||
@ -1605,7 +1605,7 @@ static struct opt_table opt_config_table[] = {
|
|||||||
#endif
|
#endif
|
||||||
OPT_WITH_ARG("--intensity|-I",
|
OPT_WITH_ARG("--intensity|-I",
|
||||||
set_intensity, NULL, NULL,
|
set_intensity, NULL, NULL,
|
||||||
"Intensity of GPU scanning (d or -10 -> 14, default: d to maintain desktop interactivity)"),
|
"Intensity of GPU scanning (d or " _MIN_INTENSITY_STR " -> " _MAX_INTENSITY_STR ", default: d to maintain desktop interactivity)"),
|
||||||
OPT_WITH_ARG("--kernel-path|-K",
|
OPT_WITH_ARG("--kernel-path|-K",
|
||||||
opt_set_charp, opt_show_charp, &opt_kernel_path,
|
opt_set_charp, opt_show_charp, &opt_kernel_path,
|
||||||
"Specify a path to where the kernel .cl files are"),
|
"Specify a path to where the kernel .cl files are"),
|
||||||
@ -3721,7 +3721,7 @@ retry:
|
|||||||
wlogprint("Invalid selection\n");
|
wlogprint("Invalid selection\n");
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
intvar = curses_input("Set GPU scan intensity (d or -10 -> 10)");
|
intvar = curses_input("Set GPU scan intensity (d or " _MIN_INTENSITY_STR " -> " _MAX_INTENSITY_STR ")");
|
||||||
if (!intvar) {
|
if (!intvar) {
|
||||||
wlogprint("Invalid input\n");
|
wlogprint("Invalid input\n");
|
||||||
goto retry;
|
goto retry;
|
||||||
@ -3734,7 +3734,7 @@ retry:
|
|||||||
}
|
}
|
||||||
intensity = atoi(intvar);
|
intensity = atoi(intvar);
|
||||||
free(intvar);
|
free(intvar);
|
||||||
if (intensity < -10 || intensity > 10) {
|
if (intensity < MIN_INTENSITY || intensity > MAX_INTENSITY) {
|
||||||
wlogprint("Invalid selection\n");
|
wlogprint("Invalid selection\n");
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
@ -5742,10 +5742,10 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work, uint64_
|
|||||||
* increase intensity when the system is idle, unless
|
* increase intensity when the system is idle, unless
|
||||||
* dynamic is disabled. */
|
* dynamic is disabled. */
|
||||||
if (gpu_ms_average > 7) {
|
if (gpu_ms_average > 7) {
|
||||||
if (gpu->intensity > -10)
|
if (gpu->intensity > MIN_INTENSITY)
|
||||||
--gpu->intensity;
|
--gpu->intensity;
|
||||||
} else if (gpu_ms_average < 3) {
|
} else if (gpu_ms_average < 3) {
|
||||||
if (gpu->intensity < 10)
|
if (gpu->intensity < 10) // Should this be MAX_INTENSITY?
|
||||||
++gpu->intensity;
|
++gpu->intensity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
miner.h
5
miner.h
@ -545,6 +545,11 @@ extern void api(void);
|
|||||||
#define MAX_DEVICES 32
|
#define MAX_DEVICES 32
|
||||||
#define MAX_POOLS (32)
|
#define MAX_POOLS (32)
|
||||||
|
|
||||||
|
#define MIN_INTENSITY -10
|
||||||
|
#define _MIN_INTENSITY_STR "-10"
|
||||||
|
#define MAX_INTENSITY 14
|
||||||
|
#define _MAX_INTENSITY_STR "14"
|
||||||
|
|
||||||
extern struct list_head scan_devices;
|
extern struct list_head scan_devices;
|
||||||
extern int nDevs;
|
extern int nDevs;
|
||||||
extern int opt_n_threads;
|
extern int opt_n_threads;
|
||||||
|
Loading…
Reference in New Issue
Block a user