Added --max-cpu-usage and --safe stub.

This commit is contained in:
XMRig 2017-05-08 10:29:25 +03:00
parent 0dcf127c26
commit 15b4244ea8
2 changed files with 57 additions and 36 deletions

View file

@ -42,10 +42,12 @@ int opt_algo_variant = 0;
int opt_retries = 5;
int opt_retry_pause = 5;
int opt_donate_level = DONATE_LEVEL;
int opt_max_cpu_usage = 75;
bool opt_colors = true;
bool opt_keepalive = false;
bool opt_background = false;
bool opt_double_hash = false;
bool opt_safe = false;
char *opt_url = NULL;
char *opt_backup_url = NULL;
char *opt_userpass = NULL;
@ -71,6 +73,8 @@ Options:\n\
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
-B, --background run the miner in the background\n\
-c, --config=FILE load a JSON-format configuration file\n\
--max-cpu-usage=N maximum cpu usage for automatic threads mode (default 75)\n\
--safe safe adjust threads and av settings for current cpu\n\
-h, --help display this help and exit\n\
-V, --version output version information and exit\n\
";
@ -89,10 +93,12 @@ static struct option const options[] = {
{ "donate-level", 1, NULL, 1003 },
{ "help", 0, NULL, 'h' },
{ "keepalive", 0, NULL ,'k' },
{ "max-cpu-usage", 1, NULL, 1004 },
{ "no-color", 0, NULL, 1002 },
{ "pass", 1, NULL, 'p' },
{ "retries", 1, NULL, 'r' },
{ "retry-pause", 1, NULL, 'R' },
{ "safe", 0, NULL, 1005 },
{ "threads", 1, NULL, 't' },
{ "url", 1, NULL, 'o' },
{ "user", 1, NULL, 'u' },
@ -197,7 +203,20 @@ static void parse_arg(int key, char *arg) {
opt_n_threads = v;
break;
case 'k':
case 1004: /* --max-cpu-usage */
v = atoi(arg);
if (v < 1 || v > 100) {
show_usage_and_exit(1);
}
opt_max_cpu_usage = v;
break;
case 1005: /* --safe */
opt_safe = true;
break;
case 'k': /* --keepalive */
opt_keepalive = true;
break;
@ -227,7 +246,7 @@ static void parse_arg(int key, char *arg) {
break;
}
case 'B':
case 'B': /* --background */
opt_background = true;
opt_colors = false;
break;
@ -255,7 +274,7 @@ static void parse_arg(int key, char *arg) {
opt_colors = false;
break;
case 1003:
case 1003: /* --donate-level */
v = atoi(arg);
if (v < 1 || v > 99) {
show_usage_and_exit(1);

View file

@ -47,6 +47,7 @@ extern bool opt_colors;
extern bool opt_keepalive;
extern bool opt_background;
extern bool opt_double_hash;
extern bool opt_safe;
extern char *opt_url;
extern char *opt_backup_url;
extern char *opt_userpass;
@ -57,6 +58,7 @@ extern int opt_algo_variant;
extern int opt_retry_pause;
extern int opt_retries;
extern int opt_donate_level;
extern int opt_max_cpu_usage;
extern int64_t opt_affinity;
void parse_cmdline(int argc, char *argv[]);