Added hwloc version display.

This commit is contained in:
XMRig 2019-07-23 07:45:00 +07:00
parent b27fc6fd5d
commit 4263c6c381
4 changed files with 56 additions and 36 deletions

View file

@ -39,6 +39,9 @@
#include "version.h" #include "version.h"
namespace xmrig {
#ifdef XMRIG_FEATURE_ASM #ifdef XMRIG_FEATURE_ASM
static const char *coloredAsmNames[] = { static const char *coloredAsmNames[] = {
RED_BOLD("none"), RED_BOLD("none"),
@ -49,24 +52,23 @@ static const char *coloredAsmNames[] = {
}; };
inline static const char *asmName(xmrig::Assembly::Id assembly) inline static const char *asmName(Assembly::Id assembly)
{ {
return coloredAsmNames[assembly]; return coloredAsmNames[assembly];
} }
#endif #endif
static void print_memory(xmrig::Config *) { static void print_memory(Config *) {
# ifdef _WIN32 # ifdef _WIN32
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s", Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
"HUGE PAGES", xmrig::VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("available") : RED_BOLD("unavailable")); "HUGE PAGES", VirtualMemory::isHugepagesAvailable() ? GREEN_BOLD("available") : RED_BOLD("unavailable"));
# endif # endif
} }
static void print_cpu(xmrig::Config *) static void print_cpu(Config *)
{ {
using namespace xmrig;
const ICpuInfo *info = Cpu::info(); const ICpuInfo *info = Cpu::info();
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%zu/%zu)") " %sx64 %sAES %sAVX2", Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%zu/%zu)") " %sx64 %sAES %sAVX2",
@ -95,41 +97,44 @@ static void print_cpu(xmrig::Config *)
} }
static void print_threads(xmrig::Config *config) static void print_threads(Config *config)
{ {
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s%d%%"), Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s%d%%"),
"DONATE", "DONATE",
config->pools().donateLevel() == 0 ? RED_BOLD_S : "", config->pools().donateLevel() == 0 ? RED_BOLD_S : "",
config->pools().donateLevel() config->pools().donateLevel()
); );
# ifdef XMRIG_FEATURE_ASM # ifdef XMRIG_FEATURE_ASM
if (config->cpu().assembly() == xmrig::Assembly::AUTO) { if (config->cpu().assembly() == Assembly::AUTO) {
const xmrig::Assembly assembly = xmrig::Cpu::info()->assembly(); const Assembly assembly = Cpu::info()->assembly();
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s"), "ASSEMBLY", asmName(assembly)); Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s"), "ASSEMBLY", asmName(assembly));
} }
else { else {
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s"), "ASSEMBLY", asmName(config->cpu().assembly())); Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s"), "ASSEMBLY", asmName(config->cpu().assembly()));
} }
# endif # endif
} }
static void print_commands(xmrig::Config *) static void print_commands(Config *)
{ {
if (xmrig::Log::colors) { if (Log::colors) {
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ") Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ")
MAGENTA_BOLD("p") WHITE_BOLD("ause, ") MAGENTA_BOLD("p") WHITE_BOLD("ause, ")
MAGENTA_BOLD("r") WHITE_BOLD("esume")); MAGENTA_BOLD("r") WHITE_BOLD("esume"));
} }
else { else {
xmrig::Log::print(" * COMMANDS 'h' hashrate, 'p' pause, 'r' resume"); Log::print(" * COMMANDS 'h' hashrate, 'p' pause, 'r' resume");
} }
} }
void Summary::print(xmrig::Controller *controller) } // namespace xmrig
void xmrig::Summary::print(Controller *controller)
{ {
controller->config()->printVersions(); controller->config()->printVersions();
print_memory(controller->config()); print_memory(controller->config());

View file

@ -5,7 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * 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> * Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -21,20 +22,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SUMMARY_H__ #ifndef XMRIG_SUMMARY_H
#define __SUMMARY_H__ #define XMRIG_SUMMARY_H
namespace xmrig { namespace xmrig {
class Controller;
}
class Controller;
class Summary class Summary
{ {
public: public:
static void print(xmrig::Controller *controller); static void print(Controller *controller);
}; };
#endif /* __SUMMARY_H__ */ } // namespace xmrig
#endif /* XMRIG_SUMMARY_H */

View file

@ -31,6 +31,9 @@
# include <openssl/opensslv.h> # include <openssl/opensslv.h>
#endif #endif
#ifdef XMRIG_FEATURE_HWLOC
# include <hwloc.h>
#endif
#include "base/kernel/Entry.h" #include "base/kernel/Entry.h"
#include "base/kernel/Process.h" #include "base/kernel/Process.h"
@ -75,6 +78,8 @@ static int showVersion()
} }
# endif # endif
printf("hwloc/%s\n", HWLOC_VERSION);
return 0; return 0;
} }

View file

@ -34,6 +34,9 @@
# include <openssl/opensslv.h> # include <openssl/opensslv.h>
#endif #endif
#ifdef XMRIG_FEATURE_HWLOC
# include <hwloc.h>
#endif
#ifdef XMRIG_AMD_PROJECT #ifdef XMRIG_AMD_PROJECT
# if defined(__APPLE__) # if defined(__APPLE__)
@ -95,22 +98,24 @@ void xmrig::BaseConfig::printVersions()
# elif defined(XMRIG_NVIDIA_PROJECT) # elif defined(XMRIG_NVIDIA_PROJECT)
const int cudaVersion = cuda_get_runtime_version(); const int cudaVersion = cuda_get_runtime_version();
int length = snprintf(buf, sizeof buf, "CUDA/%d.%d ", cudaVersion / 1000, cudaVersion % 100); int length = snprintf(buf, sizeof buf, "CUDA/%d.%d ", cudaVersion / 1000, cudaVersion % 100);
# else # endif
memset(buf, 0, 16);
# if defined(XMRIG_FEATURE_HTTP) || defined(XMRIG_FEATURE_TLS) std::string libs;
int length = 0;
# endif
# endif
# if defined(XMRIG_FEATURE_TLS) && defined(OPENSSL_VERSION_TEXT) # if defined(XMRIG_FEATURE_TLS) && defined(OPENSSL_VERSION_TEXT)
{ {
constexpr const char *v = OPENSSL_VERSION_TEXT + 8; constexpr const char *v = OPENSSL_VERSION_TEXT + 8;
length += snprintf(buf + length, (sizeof buf) - length, "OpenSSL/%.*s ", static_cast<int>(strchr(v, ' ') - v), v); snprintf(buf, sizeof buf, "OpenSSL/%.*s ", static_cast<int>(strchr(v, ' ') - v), v);
libs += buf;
} }
# endif # endif
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13slibuv/%s %s"), "LIBS", uv_version_string(), buf); # ifdef XMRIG_FEATURE_HWLOC
snprintf(buf, sizeof buf, "hwloc/%s ", HWLOC_VERSION);
libs += buf;
# endif
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13slibuv/%s %s"), "LIBS", uv_version_string(), libs.c_str());
} }