Added cpu sockets to dashboard client info popup

* Removed not working background mode for *nix
This commit is contained in:
BenDr0id 2018-01-04 17:32:56 +01:00
parent 36596dda59
commit 9620fe0eeb
12 changed files with 57 additions and 41 deletions

12
config_cc.json Normal file
View file

@ -0,0 +1,12 @@
{
"background": false,
"colors": true,
"log-file": null,
"syslog": false,
"cc-server": {
"port": 3344, // port the CC Server will listens on
"access-token": "mySecret", // access token for CC Clients
"user": "admin", // admin user for access CC Dashboard
"pass": "pass" // admin pass for access CC Dashboard
}
}

View file

@ -49,7 +49,7 @@
<script src="https://use.fontawesome.com/6b3cdfc597.js"></script> <script src="https://use.fontawesome.com/6b3cdfc597.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var TRESHOLD_IN_MS = 60 * 1000; var TRESHOLD_IN_MS = 90 * 1000;
var RELOAD_INTERVAL_IN_MS = 10 * 1000; var RELOAD_INTERVAL_IN_MS = 10 * 1000;
$.fn.dataTable.ext.search.push( $.fn.dataTable.ext.search.push(
@ -446,7 +446,7 @@
function clientInfo( data, type, row ) { function clientInfo( data, type, row ) {
if (type !== 'sort') { if (type !== 'sort') {
var tooltip = "CPU: " + row.client_status.cpu_brand + " [" + row.client_status.cpu_cores + " cores / " + row.client_status.cpu_threads + " threads]"; var tooltip = "CPU: " + row.client_status.cpu_brand + " (" + row.client_status.cpu_sockets + ") [" + row.client_status.cpu_cores + " cores / " + row.client_status.cpu_threads + " threads]";
tooltip += '\n'; tooltip += '\n';
tooltip += "CPU Flags: " + (row.client_status.cpu_has_aes ? "AES-NI " : ""); tooltip += "CPU Flags: " + (row.client_status.cpu_has_aes ? "AES-NI " : "");
tooltip += (row.client_status.cpu_is_x64 ? "x64" : ""); tooltip += (row.client_status.cpu_is_x64 ? "x64" : "");

View file

@ -72,10 +72,14 @@ App::App(int argc, char **argv) :
Log::init(); Log::init();
# ifdef WIN32
if (!m_options->background()) { if (!m_options->background()) {
# endif
Log::add(new ConsoleLog(m_options->colors())); Log::add(new ConsoleLog(m_options->colors()));
m_console = new Console(this); m_console = new Console(this);
# ifdef WIN32
} }
# endif
if (m_options->logFile()) { if (m_options->logFile()) {
Log::add(new FileLog(m_options->logFile())); Log::add(new FileLog(m_options->logFile()));

View file

@ -22,17 +22,12 @@
*/ */
#include <stdlib.h> #include <string>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include "App.h" #include "App.h"
#include "Cpu.h" #include "Cpu.h"
#include "log/Log.h" #include "log/Log.h"
#include "Options.h" #include "Options.h"
#include "version.h"
void App::background() void App::background()
{ {
@ -40,27 +35,6 @@ void App::background()
Cpu::setAffinity(-1, m_options->affinity()); Cpu::setAffinity(-1, m_options->affinity());
} }
if (!m_options->background()) { Log::i()->text(Options::i()->colors() ? "\x1B[01;31m\nBackground mode is not supported by %s on *nix Systems. Please use screen/tmux or systemd service instead.\n"
return; : "\nBackground mode is not supported by %s on *nix Systems. Please use screen/tmux or systemd service instead.\n", APP_NAME);
}
int i = fork();
if (i < 0) {
exit(1);
}
if (i > 0) {
exit(0);
}
i = setsid();
if (i < 0) {
LOG_ERR("setsid() failed (errno = %d)", errno);
}
i = chdir("/");
if (i < 0) {
LOG_ERR("chdir() failed (errno = %d)", errno);
}
} }

View file

@ -128,7 +128,7 @@ static void print_threads()
affBuf[0] = '\0'; affBuf[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%s" : " * THREADS: %d, %s, av=%d, %sdonate=%d%%%s%s", Log::i()->text(Options::i()->colors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, av=%d, %sdonate=%d%%\x1B[01;37m%s%s" : " * THREADS: %d, %s, av=%d, %sdonate=%d%%%s%s",
Options::i()->threads(), Options::i()->threads(),
Options::i()->algoName(), Options::i()->algoName(),
Options::i()->algoVariant(), Options::i()->algoVariant(),

View file

@ -84,10 +84,10 @@ CCClient::CCClient(Options* options, uv_async_t* async)
m_clientStatus.setVersion(Version::string()); m_clientStatus.setVersion(Version::string());
m_clientStatus.setCpuBrand(Cpu::brand()); m_clientStatus.setCpuBrand(Cpu::brand());
m_clientStatus.setCpuAES(Cpu::hasAES()); m_clientStatus.setCpuAES(Cpu::hasAES());
m_clientStatus.setCpuSockets(Cpu::sockets());
m_clientStatus.setCpuCores(Cpu::cores()); m_clientStatus.setCpuCores(Cpu::cores());
m_clientStatus.setCpuThreads(Cpu::threads()); m_clientStatus.setCpuThreads(Cpu::threads());
m_clientStatus.setCpuX64(Cpu::isX64()); m_clientStatus.setCpuX64(Cpu::isX64());
m_clientStatus.setCpuL2(Cpu::l2()); m_clientStatus.setCpuL2(Cpu::l2());
m_clientStatus.setCpuL3(Cpu::l3()); m_clientStatus.setCpuL3(Cpu::l3());
m_clientStatus.setCurrentThreads(m_options->threads()); m_clientStatus.setCurrentThreads(m_options->threads());

View file

@ -43,6 +43,7 @@ ClientStatus::ClientStatus()
m_hashrateLong(0), m_hashrateLong(0),
m_hashrateHighest(0), m_hashrateHighest(0),
m_currentThreads(0), m_currentThreads(0),
m_cpuSockets(0),
m_cpuCores(0), m_cpuCores(0),
m_cpuThreads(0), m_cpuThreads(0),
m_cpuL2(0), m_cpuL2(0),
@ -226,6 +227,16 @@ void ClientStatus::setCurrentThreads(int currentThreads)
m_currentThreads = currentThreads; m_currentThreads = currentThreads;
} }
int ClientStatus::getCpuSockets() const
{
return m_cpuSockets;
}
void ClientStatus::setCpuSockets(int cpuSockets)
{
m_cpuSockets = cpuSockets;
}
int ClientStatus::getCpuCores() const int ClientStatus::getCpuCores() const
{ {
return m_cpuCores; return m_cpuCores;
@ -386,6 +397,10 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
m_currentThreads = clientStatus["current_threads"].GetInt(); m_currentThreads = clientStatus["current_threads"].GetInt();
} }
if (clientStatus.HasMember("cpu_sockets")) {
m_cpuSockets = clientStatus["cpu_sockets"].GetInt();
}
if (clientStatus.HasMember("cpu_cores")) { if (clientStatus.HasMember("cpu_cores")) {
m_cpuCores = clientStatus["cpu_cores"].GetInt(); m_cpuCores = clientStatus["cpu_cores"].GetInt();
} }
@ -454,6 +469,7 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
clientStatus.AddMember("hashrate_highest", m_hashrateHighest, allocator); clientStatus.AddMember("hashrate_highest", m_hashrateHighest, allocator);
clientStatus.AddMember("current_threads", m_currentThreads, allocator); clientStatus.AddMember("current_threads", m_currentThreads, allocator);
clientStatus.AddMember("cpu_sockets", m_cpuSockets, allocator);
clientStatus.AddMember("cpu_cores", m_cpuCores, allocator); clientStatus.AddMember("cpu_cores", m_cpuCores, allocator);
clientStatus.AddMember("cpu_threads", m_cpuThreads, allocator); clientStatus.AddMember("cpu_threads", m_cpuThreads, allocator);
clientStatus.AddMember("cpu_l2", m_cpuL2, allocator); clientStatus.AddMember("cpu_l2", m_cpuL2, allocator);

View file

@ -109,6 +109,9 @@ public:
int getCurrentThreads() const; int getCurrentThreads() const;
void setCurrentThreads(int currentThreads); void setCurrentThreads(int currentThreads);
int getCpuSockets() const;
void setCpuSockets(int cpuSockets);
int getCpuCores() const; int getCpuCores() const;
void setCpuCores(int cpuCores); void setCpuCores(int cpuCores);
@ -168,6 +171,7 @@ private:
double m_hashrateHighest; double m_hashrateHighest;
int m_currentThreads; int m_currentThreads;
int m_cpuSockets;
int m_cpuCores; int m_cpuCores;
int m_cpuThreads; int m_cpuThreads;
int m_cpuL2; int m_cpuL2;

View file

@ -35,10 +35,16 @@
int main(int argc, char **argv) { int main(int argc, char **argv) {
std::string ownPath(argv[0]); std::string ownPath(argv[0]);
std::string xmrigDaemon("xmrigDaemon");
std::string xmrigMiner("xmrigMiner");
std::string xmrigMinerPath = ownPath.replace(ownPath.rfind(xmrigDaemon),xmrigDaemon.size(), xmrigMiner); #if defined(_WIN32) || defined(WIN32)
int pos = ownPath.rfind('\\');
std::string xmrigMiner("xmrigMiner.exe");
#else
int pos = ownPath.rfind('/');
std::string xmrigMiner("xmrigMiner");
#endif
std::string xmrigMinerPath = ownPath.substr(0, pos+1) + xmrigMiner;
#ifdef WIN32 #ifdef WIN32
xmrigMinerPath = "\"" + xmrigMinerPath + "\""; xmrigMinerPath = "\"" + xmrigMinerPath + "\"";

View file

@ -2,7 +2,7 @@
"algo": "cryptonight", // cryptonight (default) or cryptonight-lite "algo": "cryptonight", // cryptonight (default) or cryptonight-lite
"av": 0, // algorithm variation, 0 auto select "av": 0, // algorithm variation, 0 auto select
"doublehash-thread-mask" : null, // for av=2/4 only, limits doublehash to given threads (mask), mask "0x3" means run doublehash on thread 0 and 1 only (default: all threads) "doublehash-thread-mask" : null, // for av=2/4 only, limits doublehash to given threads (mask), mask "0x3" means run doublehash on thread 0 and 1 only (default: all threads)
"background": false, // true to run the miner in the background "background": false, // true to run the miner in the background (Windows only, for *nix plase use screen/tmux or systemd service instead)
"colors": true, // false to disable colored output "colors": true, // false to disable colored output
"cpu-affinity": null, // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1 "cpu-affinity": null, // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1
"cpu-priority": null, // set process priority (0 idle, 2 normal to 5 highest) "cpu-priority": null, // set process priority (0 idle, 2 normal to 5 highest)

View file

@ -2,7 +2,7 @@
"algo": "cryptonight", // cryptonight (default) or cryptonight-lite "algo": "cryptonight", // cryptonight (default) or cryptonight-lite
"av": 0, // algorithm variation, 0 auto select "av": 0, // algorithm variation, 0 auto select
"doublehash-thread-mask" : null, // for av=2/4 only, limits doublehash to given threads (mask), mask "0x3" means run doublehash on thread 0 and 1 only (default: all threads) "doublehash-thread-mask" : null, // for av=2/4 only, limits doublehash to given threads (mask), mask "0x3" means run doublehash on thread 0 and 1 only (default: all threads)
"background": false, // true to run the miner in the background "background": false, // true to run the miner in the background (Windows only, for *nix plase use screen/tmux or systemd service instead)
"colors": true, // false to disable colored output "colors": true, // false to disable colored output
"cpu-affinity": null, // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1 "cpu-affinity": null, // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1
"cpu-priority": null, // set process priority (0 idle, 2 normal to 5 highest) "cpu-priority": null, // set process priority (0 idle, 2 normal to 5 highest)

View file

@ -36,14 +36,14 @@
#define APP_DESC "XMRigCC CPU miner" #define APP_DESC "XMRigCC CPU miner"
#define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id" #define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id"
#endif #endif
#define APP_VERSION "1.3.0 (based on XMRig 2.4.3)" #define APP_VERSION "1.3.1 (based on XMRig 2.4.3)"
#define APP_DOMAIN "" #define APP_DOMAIN ""
#define APP_SITE "https://github.com/Bendr0id/xmrigCC" #define APP_SITE "https://github.com/Bendr0id/xmrigCC"
#define APP_KIND "cpu" #define APP_KIND "cpu"
#define APP_VER_MAJOR 1 #define APP_VER_MAJOR 1
#define APP_VER_MINOR 3 #define APP_VER_MINOR 3
#define APP_VER_BUILD 0 #define APP_VER_BUILD 1
#define APP_VER_REV 0 #define APP_VER_REV 0
#ifndef NDEBUG #ifndef NDEBUG