New log support.
This commit is contained in:
parent
17e9e036f1
commit
f43929db98
26 changed files with 96 additions and 198 deletions
103
src/Summary.cpp
103
src/Summary.cpp
|
@ -28,9 +28,9 @@
|
|||
#include <uv.h>
|
||||
|
||||
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/net/stratum/Pool.h"
|
||||
#include "common/cpu/Cpu.h"
|
||||
#include "common/log/Log.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Controller.h"
|
||||
#include "crypto/Asm.h"
|
||||
|
@ -41,62 +41,44 @@
|
|||
|
||||
#ifndef XMRIG_NO_ASM
|
||||
static const char *coloredAsmNames[] = {
|
||||
"\x1B[1;31mnone\x1B[0m",
|
||||
RED_BOLD("none"),
|
||||
"auto",
|
||||
"\x1B[1;32mintel\x1B[0m",
|
||||
"\x1B[1;32mryzen\x1B[0m",
|
||||
"\x1B[1;32mbulldozer\x1B[0m"
|
||||
GREEN_BOLD("intel"),
|
||||
GREEN_BOLD("ryzen"),
|
||||
GREEN_BOLD("bulldozer")
|
||||
};
|
||||
|
||||
|
||||
inline static const char *asmName(xmrig::Assembly assembly, bool colors)
|
||||
inline static const char *asmName(xmrig::Assembly assembly)
|
||||
{
|
||||
return colors ? coloredAsmNames[assembly] : xmrig::Asm::toString(assembly);
|
||||
return coloredAsmNames[assembly];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void print_memory(xmrig::Config *config) {
|
||||
static void print_memory(xmrig::Config *) {
|
||||
# ifdef _WIN32
|
||||
if (config->isColors()) {
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"HUGE PAGES", Mem::isHugepagesAvailable() ? "\x1B[1;32mavailable" : "\x1B[01;31munavailable");
|
||||
}
|
||||
else {
|
||||
xmrig::Log::print(" * %-13s%s", "HUGE PAGES", Mem::isHugepagesAvailable() ? "available" : "unavailable");
|
||||
}
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"HUGE PAGES", Mem::isHugepagesAvailable() ? GREEN_BOLD("available") : RED_BOLD("unavailable"));
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
static void print_cpu(xmrig::Config *config)
|
||||
static void print_cpu(xmrig::Config *)
|
||||
{
|
||||
using namespace xmrig;
|
||||
|
||||
if (config->isColors()) {
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%d)") " %sx64 %sAES %sAVX2",
|
||||
"CPU",
|
||||
Cpu::info()->brand(),
|
||||
Cpu::info()->sockets(),
|
||||
Cpu::info()->isX64() ? "\x1B[1;32m" : "\x1B[1;31m-",
|
||||
Cpu::info()->hasAES() ? "\x1B[1;32m" : "\x1B[1;31m-",
|
||||
Cpu::info()->hasAVX2() ? "\x1B[1;32m" : "\x1B[1;31m-");
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%.1f MB/%.1f MB"), "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
Log::print(" * %-13s%s (%d) %sx64 %sAES %sAVX2",
|
||||
"CPU",
|
||||
Cpu::info()->brand(),
|
||||
Cpu::info()->sockets(),
|
||||
Cpu::info()->isX64() ? "" : "-",
|
||||
Cpu::info()->hasAES() ? "" : "-",
|
||||
Cpu::info()->hasAVX2() ? "" : "-");
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Log::print(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%d)") " %sx64 %sAES %sAVX2",
|
||||
"CPU",
|
||||
Cpu::info()->brand(),
|
||||
Cpu::info()->sockets(),
|
||||
Cpu::info()->isX64() ? GREEN_BOLD_S : RED_BOLD("-"),
|
||||
Cpu::info()->hasAES() ? GREEN_BOLD_S : RED_BOLD("-"),
|
||||
Cpu::info()->hasAVX2() ? GREEN_BOLD_S : RED_BOLD("-")
|
||||
);
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%.1f MB/%.1f MB"), "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,43 +90,42 @@ static void print_threads(xmrig::Config *config)
|
|||
snprintf(buf, sizeof buf, ", affinity=0x%" PRIX64, config->affinity());
|
||||
}
|
||||
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, av=%d, %sdonate=%d%%") WHITE_BOLD("%s")
|
||||
: " * %-13s%d, %s, av=%d, %sdonate=%d%%%s",
|
||||
"THREADS",
|
||||
config->threadsCount(),
|
||||
config->algorithm().name(),
|
||||
config->algoVariant(),
|
||||
config->isColors() && config->pools().donateLevel() == 0 ? "\x1B[1;31m" : "",
|
||||
config->pools().donateLevel(),
|
||||
buf);
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, av=%d, %sdonate=%d%%") WHITE_BOLD("%s"),
|
||||
"THREADS",
|
||||
config->threadsCount(),
|
||||
config->algorithm().shortName(),
|
||||
config->algoVariant(),
|
||||
config->pools().donateLevel() == 0 ? RED_BOLD_S : "",
|
||||
config->pools().donateLevel(),
|
||||
buf
|
||||
);
|
||||
}
|
||||
else {
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, %sdonate=%d%%")
|
||||
: " * %-13s%d, %s, %sdonate=%d%%",
|
||||
"THREADS",
|
||||
config->threadsCount(),
|
||||
config->algorithm().name(),
|
||||
config->isColors() && config->pools().donateLevel() == 0 ? "\x1B[1;31m" : "",
|
||||
config->pools().donateLevel());
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, %sdonate=%d%%"),
|
||||
"THREADS",
|
||||
config->threadsCount(),
|
||||
config->algorithm().shortName(),
|
||||
config->pools().donateLevel() == 0 ? RED_BOLD_S : "",
|
||||
config->pools().donateLevel()
|
||||
);
|
||||
}
|
||||
|
||||
# ifndef XMRIG_NO_ASM
|
||||
if (config->assembly() == xmrig::ASM_AUTO) {
|
||||
const xmrig::Assembly assembly = xmrig::Cpu::info()->assembly();
|
||||
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s")
|
||||
: " * %-13sauto:%s", "ASSEMBLY", asmName(assembly, config->isColors()));
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s"), asmName(assembly));
|
||||
}
|
||||
else {
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s") : " * %-13s%s", "ASSEMBLY", asmName(config->assembly(), config->isColors()));
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s"), asmName(config->assembly()));
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
static void print_commands(xmrig::Config *config)
|
||||
static void print_commands(xmrig::Config *)
|
||||
{
|
||||
if (config->isColors()) {
|
||||
if (xmrig::Log::colors) {
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ")
|
||||
MAGENTA_BOLD("p") WHITE_BOLD("ause, ")
|
||||
MAGENTA_BOLD("r") WHITE_BOLD("esume"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue