Print threads summary.
This commit is contained in:
parent
8b83a5fe2e
commit
04c5d6d00a
18 changed files with 51 additions and 2072 deletions
|
@ -28,10 +28,11 @@
|
|||
|
||||
|
||||
#include "Console.h"
|
||||
#include "Options.h"
|
||||
#include "version.h"
|
||||
#include "Cpu.h"
|
||||
#include "donate.h"
|
||||
#include "net/Url.h"
|
||||
#include "Options.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
|
@ -198,9 +199,9 @@ Options::~Options()
|
|||
|
||||
bool Options::parseArg(int key, char *arg)
|
||||
{
|
||||
// char *p;
|
||||
char *p;
|
||||
int v;
|
||||
// uint64_t ul;
|
||||
uint64_t ul;
|
||||
Url *url;
|
||||
|
||||
switch (key) {
|
||||
|
@ -243,7 +244,7 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 'r': /* --retries */
|
||||
v = atoi(arg);
|
||||
v = strtol(arg, nullptr, 10);
|
||||
if (v < 1 || v > 1000) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
@ -253,7 +254,7 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 'R': /* --retry-pause */
|
||||
v = atoi(arg);
|
||||
v = strtol(arg, nullptr, 10);
|
||||
if (v < 1 || v > 3600) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
@ -263,7 +264,7 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 't': /* --threads */
|
||||
v = atoi(arg);
|
||||
v = strtol(arg, nullptr, 10);
|
||||
if (v < 1 || v > 1024) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
@ -273,7 +274,7 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 1004: /* --max-cpu-usage */
|
||||
v = atoi(arg);
|
||||
v = strtol(arg, nullptr, 10);
|
||||
if (v < 1 || v > 100) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
@ -304,7 +305,7 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 'v': /* --av */
|
||||
v = atoi(arg);
|
||||
v = strtol(arg, nullptr, 10);
|
||||
if (v < 0 || v > 1000) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
@ -314,13 +315,13 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 1020: /* --cpu-affinity */
|
||||
// p = strstr(arg, "0x");
|
||||
// ul = p ? strtoul(p, NULL, 16) : atol(arg);
|
||||
// if (ul > (1UL << cpu_info.total_logical_cpus) -1) {
|
||||
// ul = -1;
|
||||
// }
|
||||
p = strstr(arg, "0x");
|
||||
ul = p ? strtoul(p, NULL, 16) : atol(arg);
|
||||
if (ul > (1UL << Cpu::threads()) -1) {
|
||||
ul = -1;
|
||||
}
|
||||
|
||||
// opt_affinity = ul;
|
||||
m_affinity = ul;
|
||||
break;
|
||||
|
||||
case 1002: /* --no-color */
|
||||
|
@ -328,7 +329,7 @@ bool Options::parseArg(int key, char *arg)
|
|||
break;
|
||||
|
||||
case 1003: /* --donate-level */
|
||||
v = atoi(arg);
|
||||
v = strtol(arg, nullptr, 10);
|
||||
if (v < 1 || v > 99) {
|
||||
showUsage(1);
|
||||
return false;
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
inline bool doubleHash() const { return m_doubleHash; }
|
||||
inline bool isReady() const { return m_ready; }
|
||||
inline bool keepAlive() const { return m_keepAlive; }
|
||||
inline bool nicehash() const { return m_nicehash; }
|
||||
inline const char *pass() const { return m_pass; }
|
||||
inline const char *user() const { return m_user; }
|
||||
inline const Url *backupUrl() const { return m_backupUrl; }
|
||||
|
@ -64,6 +65,8 @@ public:
|
|||
inline int donateLevel() const { return m_donateLevel; }
|
||||
inline int retries() const { return m_retries; }
|
||||
inline int retryPause() const { return m_retryPause; }
|
||||
inline int threads() const { return m_threads; }
|
||||
inline int64_t affinity() const { return m_affinity; }
|
||||
|
||||
const char *algoName() const;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
static void print_versions()
|
||||
{
|
||||
char *buf = static_cast<char*>(malloc(16));
|
||||
char *buf = static_cast<char*>(alloca(16));
|
||||
|
||||
# ifdef __GNUC__
|
||||
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
|
@ -48,8 +48,6 @@ static void print_versions()
|
|||
} else {
|
||||
Console::i()->text(" * VERSIONS: XMRig/%s libuv/%s%s", APP_VERSION, uv_version_string(), buf);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,10 +72,40 @@ static void print_cpu()
|
|||
}
|
||||
|
||||
|
||||
static void print_threads()
|
||||
{
|
||||
char *buf = static_cast<char*>(alloca(32));
|
||||
if (Options::i()->affinity() != -1L) {
|
||||
snprintf(buf, 32, ", affinity=0x%llX", Options::i()->affinity());
|
||||
}
|
||||
else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
if (Options::i()->colors()) {
|
||||
Console::i()->text("\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, av=%d, donate=%d%%%s%s",
|
||||
Options::i()->threads(),
|
||||
Options::i()->algoName(),
|
||||
Options::i()->algoVariant(),
|
||||
Options::i()->donateLevel(),
|
||||
Options::i()->nicehash() ? ", nicehash" : "", buf);
|
||||
}
|
||||
else {
|
||||
Console::i()->text(" * THREADS: %d, %s, av=%d, donate=%d%%%s%s",
|
||||
Options::i()->threads(),
|
||||
Options::i()->algoName(),
|
||||
Options::i()->algoVariant(),
|
||||
Options::i()->donateLevel(),
|
||||
Options::i()->nicehash() ? ", nicehash" : "", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Summary::print()
|
||||
{
|
||||
print_versions();
|
||||
print_cpu();
|
||||
print_threads();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue