Add Summary.
This commit is contained in:
parent
0556fd664c
commit
9797f49456
@ -14,6 +14,7 @@ set(HEADERS
|
||||
src/Options.h
|
||||
src/Console.h
|
||||
src/Cpu.h
|
||||
src/Summary.h
|
||||
src/version.h
|
||||
)
|
||||
|
||||
@ -25,6 +26,7 @@ set(SOURCES
|
||||
src/net/Url.cpp
|
||||
src/Options.cpp
|
||||
src/Console.cpp
|
||||
src/Summary.cpp
|
||||
src/xmrig.cpp
|
||||
)
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "net/Client.h"
|
||||
#include "net/Network.h"
|
||||
#include "Options.h"
|
||||
#include "Summary.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
@ -60,6 +61,8 @@ App::exec()
|
||||
return 0;
|
||||
}
|
||||
|
||||
Summary::print();
|
||||
|
||||
m_network->connect();
|
||||
|
||||
const int r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
static void setAffinity(int id, unsigned long mask);
|
||||
|
||||
static inline bool hasAES() { return m_flags & AES; }
|
||||
static inline bool isX64() { return m_flags & X86_64; }
|
||||
static inline const char *brand() { return m_brand; }
|
||||
static inline int cores() { return m_totalCores; }
|
||||
static inline int l2() { return m_l2_cache; }
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
static inline Options* i() { return m_self; }
|
||||
static Options *parse(int argc, char **argv);
|
||||
|
||||
inline bool colors() const { return m_colors; }
|
||||
inline bool isReady() const { return m_ready; }
|
||||
inline bool keepAlive() const { return m_keepAlive; }
|
||||
inline const char *pass() const { return m_pass; }
|
||||
|
85
src/Summary.cpp
Normal file
85
src/Summary.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "Summary.h"
|
||||
#include "Console.h"
|
||||
#include "Cpu.h"
|
||||
#include "Options.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
||||
static void print_versions()
|
||||
{
|
||||
char *buf = static_cast<char*>(malloc(16));
|
||||
|
||||
# ifdef __GNUC__
|
||||
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
||||
# else
|
||||
buf[0] = '\0';
|
||||
# endif
|
||||
|
||||
|
||||
if (Options::i()->colors()) {
|
||||
Console::i()->text("\x1B[01;32m * \x1B[01;37mVERSIONS: \x1B[01;36mXMRig/%s\x1B[01;37m libuv/%s%s", APP_VERSION, uv_version_string(), buf);
|
||||
} else {
|
||||
Console::i()->text(" * VERSIONS: XMRig/%s libuv/%s%s", APP_VERSION, uv_version_string(), buf);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
|
||||
static void print_cpu()
|
||||
{
|
||||
if (Options::i()->colors()) {
|
||||
Console::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-");
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Console::i()->text("\x1B[01;32m * \x1B[01;37mCPU L2/L3: %.1f MB/%.1f MB", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
Console::i()->text(" * CPU: %s (%d) %sx64 %sAES-NI", Cpu::brand(), Cpu::sockets(), Cpu::isX64() ? "" : "-", Cpu::hasAES() ? "" : "-");
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Console::i()->text(" * CPU L2/L3: %.1f MB/%.1f MB", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Summary::print()
|
||||
{
|
||||
print_versions();
|
||||
print_cpu();
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,12 @@
|
||||
#ifndef __SUMMARY_H__
|
||||
#define __SUMMARY_H__
|
||||
|
||||
void print_summary();
|
||||
|
||||
class Summary
|
||||
{
|
||||
public:
|
||||
static void print();
|
||||
};
|
||||
|
||||
|
||||
#endif /* __SUMMARY_H__ */
|
121
utils/summary.c
121
utils/summary.c
@ -1,121 +0,0 @@
|
||||
/* 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/>.
|
||||
*/
|
||||
|
||||
#include "options.h"
|
||||
#include "applog.h"
|
||||
#include "version.h"
|
||||
#include "persistent_memory.h"
|
||||
#include "cpu.h"
|
||||
|
||||
|
||||
static void print_memory() {
|
||||
const char *t1 = (persistent_memory_flags & MEMORY_HUGEPAGES_AVAILABLE) ? OPT_COLOR(CL_LGR, "available") : OPT_COLOR(CL_LRD, "unavailable");
|
||||
const char *t2 = (persistent_memory_flags & MEMORY_HUGEPAGES_ENABLED) ? OPT_COLOR(CL_LGR, "enabled") : OPT_COLOR(CL_LRD, "disabled");
|
||||
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "HUGE PAGES: %s, %s", t1, t2);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * HUGE PAGES: %s, %s", t1, t2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void print_cpu() {
|
||||
const char *t1 = (cpu_info.flags & CPU_FLAG_X86_64) ? OPT_COLOR(CL_LGR, "x86_64") : OPT_COLOR(CL_LRD, "-x86_64");
|
||||
const char *t2 = (cpu_info.flags & CPU_FLAG_AES) ? OPT_COLOR(CL_LGR, "AES-NI") : OPT_COLOR(CL_LRD, "-AES-NI");
|
||||
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "CPU: %s (%d)", cpu_info.brand, cpu_info.sockets);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * CPU: %s (%d)", cpu_info.brand, cpu_info.sockets);
|
||||
}
|
||||
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "CPU L2/L3: %.1f MB/%.1f MB", cpu_info.l2_cache / 1024.0, cpu_info.l3_cache / 1024.0);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * CPU L2/L3: %.1f MB/%.1f MB", cpu_info.l2_cache / 1024.0, cpu_info.l3_cache / 1024.0);
|
||||
}
|
||||
# endif
|
||||
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "CPU FEATURES: %s %s", t1, t2);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * CPU FEATURES: %s %s", t1, t2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void print_threads() {
|
||||
const char *extra = "";
|
||||
if (opt_nicehash) {
|
||||
extra = ", nicehash";
|
||||
}
|
||||
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "THREADS: " CL_WHT "%d" CL_WHT ", av=%d, %s, donate=%d%%%s", opt_n_threads, opt_algo_variant, get_current_algo_name(), opt_donate_level, extra);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * THREADS: %d, av=%d, %s, donate=%d%%%s", opt_n_threads, opt_algo_variant, get_current_algo_name(), opt_donate_level, extra);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void print_stratum() {
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "STRATUM URL: " CL_LCY "%s", opt_url);
|
||||
|
||||
if (opt_backup_url) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "FAILOVER URL: " CL_LCY "%s", opt_backup_url);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT "FAILOVER URL: " CL_LRD "none");
|
||||
}
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * STRATUM URL: %s", opt_url);
|
||||
applog_notime(LOG_INFO, " * FAILOVER URL: %s", opt_backup_url ? opt_backup_url : "none");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void print_summary() {
|
||||
if (opt_colors) {
|
||||
applog_notime(LOG_INFO, CL_LGR " * " CL_WHT APP_NAME " " APP_VERSION " " CL_LCY APP_SITE);
|
||||
}
|
||||
else {
|
||||
applog_notime(LOG_INFO, " * " APP_NAME " " APP_VERSION " " APP_SITE);
|
||||
}
|
||||
|
||||
print_memory();
|
||||
print_cpu();
|
||||
print_threads();
|
||||
print_stratum();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user