2017-06-07 22:16:45 +00:00
|
|
|
/* XMRig
|
|
|
|
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
|
|
|
|
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
|
|
|
|
* 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>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2017-07-18 19:38:38 +00:00
|
|
|
#include <inttypes.h>
|
2017-06-07 22:16:45 +00:00
|
|
|
#include <uv.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "Cpu.h"
|
2017-06-20 10:04:38 +00:00
|
|
|
#include "log/Log.h"
|
2017-06-09 22:20:54 +00:00
|
|
|
#include "Mem.h"
|
2017-06-16 08:32:34 +00:00
|
|
|
#include "net/Url.h"
|
2017-06-07 22:16:45 +00:00
|
|
|
#include "Options.h"
|
2017-06-07 22:51:24 +00:00
|
|
|
#include "Summary.h"
|
2017-06-07 22:16:45 +00:00
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void print_versions()
|
|
|
|
{
|
2017-06-12 13:19:07 +00:00
|
|
|
char buf[16];
|
2017-06-07 22:16:45 +00:00
|
|
|
|
2017-06-14 17:37:59 +00:00
|
|
|
# if defined(__clang__)
|
|
|
|
snprintf(buf, 16, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
|
|
|
|
# elif defined(__GNUC__)
|
2017-06-07 22:16:45 +00:00
|
|
|
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
2017-06-13 03:31:25 +00:00
|
|
|
# elif defined(_MSC_VER)
|
|
|
|
snprintf(buf, 16, " MSVC/%d", MSVC_VERSION);
|
2017-06-07 22:16:45 +00:00
|
|
|
# else
|
|
|
|
buf[0] = '\0';
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
|
|
if (Options::i()->colors()) {
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text("\x1B[01;32m * \x1B[01;37mVERSIONS: \x1B[01;36mXMRig/%s\x1B[01;37m libuv/%s%s", APP_VERSION, uv_version_string(), buf);
|
2017-06-07 22:16:45 +00:00
|
|
|
} else {
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text(" * VERSIONS: XMRig/%s libuv/%s%s", APP_VERSION, uv_version_string(), buf);
|
2017-06-07 22:16:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-09 22:20:54 +00:00
|
|
|
static void print_memory() {
|
|
|
|
if (Options::i()->colors()) {
|
2017-06-20 10:04:38 +00:00
|
|
|
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");
|
2017-06-09 22:20:54 +00:00
|
|
|
}
|
|
|
|
else {
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text(" * HUGE PAGES: %s, %s", Mem::isHugepagesAvailable() ? "available" : "unavailable", Mem::isHugepagesEnabled() ? "enabled" : "disabled");
|
2017-06-09 22:20:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-07 22:16:45 +00:00
|
|
|
static void print_cpu()
|
|
|
|
{
|
|
|
|
if (Options::i()->colors()) {
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text("\x1B[01;32m * \x1B[01;37mCPU: %s (%d) %sx64 %sAES-NI",
|
|
|
|
Cpu::brand(),
|
|
|
|
Cpu::sockets(),
|
|
|
|
Cpu::isX64() ? "\x1B[01;32m" : "\x1B[01;31m-",
|
|
|
|
Cpu::hasAES() ? "\x1B[01;32m" : "\x1B[01;31m-");
|
2017-06-07 22:16:45 +00:00
|
|
|
# ifndef XMRIG_NO_LIBCPUID
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text("\x1B[01;32m * \x1B[01;37mCPU L2/L3: %.1f MB/%.1f MB", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
2017-06-07 22:16:45 +00:00
|
|
|
# endif
|
|
|
|
}
|
|
|
|
else {
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text(" * CPU: %s (%d) %sx64 %sAES-NI", Cpu::brand(), Cpu::sockets(), Cpu::isX64() ? "" : "-", Cpu::hasAES() ? "" : "-");
|
2017-06-07 22:16:45 +00:00
|
|
|
# ifndef XMRIG_NO_LIBCPUID
|
2017-06-20 10:04:38 +00:00
|
|
|
Log::i()->text(" * CPU L2/L3: %.1f MB/%.1f MB", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
2017-06-07 22:16:45 +00:00
|
|
|
# endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-08 23:47:46 +00:00
|
|
|
static void print_threads()
|
|
|
|
{
|
2017-06-12 13:19:07 +00:00
|
|
|
char buf[32];
|
2017-06-08 23:47:46 +00:00
|
|
|
if (Options::i()->affinity() != -1L) {
|
2017-07-18 19:38:38 +00:00
|
|
|
snprintf(buf, 32, ", affinity=0x%" PRIX64, Options::i()->affinity());
|
2017-06-08 23:47:46 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
buf[0] = '\0';
|
|
|
|
}
|
|
|
|
|
2017-07-01 17:53:42 +00:00
|
|
|
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",
|
2017-06-20 10:04:38 +00:00
|
|
|
Options::i()->threads(),
|
|
|
|
Options::i()->algoName(),
|
|
|
|
Options::i()->algoVariant(),
|
2017-07-01 17:53:42 +00:00
|
|
|
Options::i()->colors() && Options::i()->donateLevel() == 0 ? "\x1B[01;31m" : "",
|
2017-06-20 10:04:38 +00:00
|
|
|
Options::i()->donateLevel(),
|
2017-06-27 03:32:17 +00:00
|
|
|
buf);
|
2017-06-16 08:32:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void print_pools()
|
|
|
|
{
|
2017-06-26 18:13:05 +00:00
|
|
|
const std::vector<Url*> &pools = Options::i()->pools();
|
2017-06-16 08:32:34 +00:00
|
|
|
|
2017-06-26 18:13:05 +00:00
|
|
|
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",
|
|
|
|
i + 1,
|
|
|
|
pools[i]->host(),
|
|
|
|
pools[i]->port());
|
2017-06-08 23:47:46 +00:00
|
|
|
}
|
2017-06-16 08:32:34 +00:00
|
|
|
|
2017-06-26 18:13:05 +00:00
|
|
|
# ifdef APP_DEBUG
|
|
|
|
for (size_t i = 0; i < pools.size(); ++i) {
|
|
|
|
Log::i()->text("%s:%d, user: %s, pass: %s, ka: %d, nicehash: %d", pools[i]->host(), pools[i]->port(), pools[i]->user(), pools[i]->password(), pools[i]->isKeepAlive(), pools[i]->isNicehash());
|
|
|
|
}
|
|
|
|
# endif
|
2017-06-08 23:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-07 22:16:45 +00:00
|
|
|
void Summary::print()
|
|
|
|
{
|
|
|
|
print_versions();
|
2017-06-09 22:20:54 +00:00
|
|
|
print_memory();
|
2017-06-07 22:16:45 +00:00
|
|
|
print_cpu();
|
2017-06-08 23:47:46 +00:00
|
|
|
print_threads();
|
2017-06-16 08:32:34 +00:00
|
|
|
print_pools();
|
2017-06-07 22:16:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|