Options class replaced to xmrig::Config.
This commit is contained in:
parent
aad19f1a35
commit
aac7b0404a
25 changed files with 240 additions and 1104 deletions
|
@ -4,8 +4,8 @@
|
|||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
*
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,16 +27,17 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "Cpu.h"
|
||||
#include "log/Log.h"
|
||||
#include "Mem.h"
|
||||
#include "net/Url.h"
|
||||
#include "Options.h"
|
||||
#include "Summary.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
static void print_versions()
|
||||
static void print_versions(xmrig::Config *config)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
|
@ -51,13 +52,13 @@ static void print_versions()
|
|||
# endif
|
||||
|
||||
|
||||
Log::i()->text(Options::i()->colors() ? "\x1B[01;32m * \x1B[01;37mVERSIONS: \x1B[01;36mXMRig/%s\x1B[01;37m libuv/%s%s" : " * VERSIONS: XMRig/%s libuv/%s%s",
|
||||
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mVERSIONS: \x1B[01;36mXMRig/%s\x1B[01;37m libuv/%s%s" : " * VERSIONS: XMRig/%s libuv/%s%s",
|
||||
APP_VERSION, uv_version_string(), buf);
|
||||
}
|
||||
|
||||
|
||||
static void print_memory() {
|
||||
if (Options::i()->colors()) {
|
||||
static void print_memory(xmrig::Config *config) {
|
||||
if (config->isColors()) {
|
||||
Log::i()->text("\x1B[01;32m * \x1B[01;37mHUGE PAGES: %s, %s",
|
||||
Mem::isHugepagesAvailable() ? "\x1B[01;32mavailable" : "\x1B[01;31munavailable",
|
||||
Mem::isHugepagesEnabled() ? "\x1B[01;32menabled" : "\x1B[01;31mdisabled");
|
||||
|
@ -68,9 +69,9 @@ static void print_memory() {
|
|||
}
|
||||
|
||||
|
||||
static void print_cpu()
|
||||
static void print_cpu(xmrig::Config *config)
|
||||
{
|
||||
if (Options::i()->colors()) {
|
||||
if (config->isColors()) {
|
||||
Log::i()->text("\x1B[01;32m * \x1B[01;37mCPU: %s (%d) %sx64 %sAES-NI",
|
||||
Cpu::brand(),
|
||||
Cpu::sockets(),
|
||||
|
@ -89,32 +90,32 @@ static void print_cpu()
|
|||
}
|
||||
|
||||
|
||||
static void print_threads()
|
||||
static void print_threads(xmrig::Config *config)
|
||||
{
|
||||
char buf[32];
|
||||
if (Options::i()->affinity() != -1L) {
|
||||
snprintf(buf, 32, ", affinity=0x%" PRIX64, Options::i()->affinity());
|
||||
if (config->affinity() != -1L) {
|
||||
snprintf(buf, 32, ", affinity=0x%" PRIX64, config->affinity());
|
||||
}
|
||||
else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
Log::i()->text(Options::i()->colors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, av=%d, %sdonate=%d%%%s" : " * THREADS: %d, %s, av=%d, %sdonate=%d%%%s",
|
||||
Options::i()->threads(),
|
||||
Options::i()->algoName(),
|
||||
Options::i()->algoVariant(),
|
||||
Options::i()->colors() && Options::i()->donateLevel() == 0 ? "\x1B[01;31m" : "",
|
||||
Options::i()->donateLevel(),
|
||||
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, av=%d, %sdonate=%d%%%s" : " * THREADS: %d, %s, av=%d, %sdonate=%d%%%s",
|
||||
config->threads(),
|
||||
config->algoName(),
|
||||
config->algoVariant(),
|
||||
config->isColors() && config->donateLevel() == 0 ? "\x1B[01;31m" : "",
|
||||
config->donateLevel(),
|
||||
buf);
|
||||
}
|
||||
|
||||
|
||||
static void print_pools()
|
||||
static void print_pools(xmrig::Config *config)
|
||||
{
|
||||
const std::vector<Url*> &pools = Options::i()->pools();
|
||||
const std::vector<Url*> &pools = config->pools();
|
||||
|
||||
for (size_t i = 0; i < pools.size(); ++i) {
|
||||
Log::i()->text(Options::i()->colors() ? "\x1B[01;32m * \x1B[01;37mPOOL #%d: \x1B[01;36m%s:%d" : " * POOL #%d: %s:%d",
|
||||
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mPOOL #%d: \x1B[01;36m%s:%d" : " * POOL #%d: %s:%d",
|
||||
i + 1,
|
||||
pools[i]->host(),
|
||||
pools[i]->port());
|
||||
|
@ -129,20 +130,20 @@ static void print_pools()
|
|||
|
||||
|
||||
#ifndef XMRIG_NO_API
|
||||
static void print_api()
|
||||
static void print_api(xmrig::Config *config)
|
||||
{
|
||||
if (Options::i()->apiPort() == 0) {
|
||||
if (config->apiPort() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log::i()->text(Options::i()->colors() ? "\x1B[01;32m * \x1B[01;37mAPI PORT: \x1B[01;36m%d" : " * API PORT: %d", Options::i()->apiPort());
|
||||
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mAPI PORT: \x1B[01;36m%d" : " * API PORT: %d", config->apiPort());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void print_commands()
|
||||
static void print_commands(xmrig::Config *config)
|
||||
{
|
||||
if (Options::i()->colors()) {
|
||||
if (config->isColors()) {
|
||||
Log::i()->text("\x1B[01;32m * \x1B[01;37mCOMMANDS: \x1B[01;35mh\x1B[01;37mashrate, \x1B[01;35mp\x1B[01;37mause, \x1B[01;35mr\x1B[01;37mesume");
|
||||
}
|
||||
else {
|
||||
|
@ -151,19 +152,19 @@ static void print_commands()
|
|||
}
|
||||
|
||||
|
||||
void Summary::print()
|
||||
void Summary::print(xmrig::Controller *controller)
|
||||
{
|
||||
print_versions();
|
||||
print_memory();
|
||||
print_cpu();
|
||||
print_threads();
|
||||
print_pools();
|
||||
print_versions(controller->config());
|
||||
print_memory(controller->config());
|
||||
print_cpu(controller->config());
|
||||
print_threads(controller->config());
|
||||
print_pools(controller->config());
|
||||
|
||||
# ifndef XMRIG_NO_API
|
||||
print_api();
|
||||
print_api(controller->config());
|
||||
# endif
|
||||
|
||||
print_commands();
|
||||
print_commands(controller->config());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue