Merged branch dev into master

This commit is contained in:
BenDroid 2018-01-04 20:14:51 +01:00
commit 882d52927a
16 changed files with 77 additions and 56 deletions

View file

@ -20,7 +20,7 @@ Full Windows/Linux compatible, and you can mix Linux and Windows miner on one XM
**XMRigCC Dashboard**
![Screenshot of XMRigCC Dashboard](https://i.imgur.com/D2y4V0V.png)
![Screenshot of XMRigCC Dashboard](https://i.imgur.com/VwJaf26.png)
**[Find HELP/HOWTO](https://github.com/Bendr0id/xmrigCC/wiki/)**
@ -179,7 +179,7 @@ This will limit doublehash mode (av=2,av=4) to thread 0 and thread 2, thread 1 a
### HUGE PAGES unavailable (Windows)
* Run XMRig as Administrator.
* Since version 0.8.0 XMRig automatically enable SeLockMemoryPrivilege for current user, but reboot or sign out still required. [Manual instruction](https://msdn.microsoft.com/en-gb/library/ms190730.aspx).
* Since version 0.8.0 XMRig automatically enables SeLockMemoryPrivilege for current user, but reboot or sign out still required. [Manual instruction](https://msdn.microsoft.com/en-gb/library/ms190730.aspx).
### HUGE PAGES unavailable (Linux)
* Before starting XMRigDaemon set huge pages

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 type="text/javascript">
var TRESHOLD_IN_MS = 60 * 1000;
var TRESHOLD_IN_MS = 90 * 1000;
var RELOAD_INTERVAL_IN_MS = 10 * 1000;
$.fn.dataTable.ext.search.push(
@ -446,7 +446,7 @@
function clientInfo( data, type, row ) {
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 += "CPU Flags: " + (row.client_status.cpu_has_aes ? "AES-NI " : "");
tooltip += (row.client_status.cpu_is_x64 ? "x64" : "");

View file

@ -72,10 +72,14 @@ App::App(int argc, char **argv) :
Log::init();
# ifdef WIN32
if (!m_options->background()) {
# endif
Log::add(new ConsoleLog(m_options->colors()));
m_console = new Console(this);
# ifdef WIN32
}
# endif
if (m_options->logFile()) {
Log::add(new FileLog(m_options->logFile()));
@ -92,7 +96,9 @@ App::App(int argc, char **argv) :
m_network = new Network(m_options);
uv_signal_init(uv_default_loop(), &m_signal);
uv_signal_init(uv_default_loop(), &m_sigHUP);
uv_signal_init(uv_default_loop(), &m_sigINT);
uv_signal_init(uv_default_loop(), &m_sigTERM);
}
App::~App()
@ -123,9 +129,9 @@ int App::start()
return EINVAL;
}
uv_signal_start(&m_signal, App::onSignal, SIGHUP);
uv_signal_start(&m_signal, App::onSignal, SIGTERM);
uv_signal_start(&m_signal, App::onSignal, SIGINT);
uv_signal_start(&m_sigHUP, App::onSignal, SIGHUP);
uv_signal_start(&m_sigINT, App::onSignal, SIGINT);
uv_signal_start(&m_sigTERM, App::onSignal, SIGTERM);
background();

View file

@ -66,8 +66,10 @@ private:
Httpd *m_httpd;
Network *m_network;
Options *m_options;
uv_signal_t m_sigHUP;
uv_signal_t m_sigINT;
uv_signal_t m_sigTERM;
CCClient *m_ccclient;
uv_signal_t m_signal;
uv_async_t m_async;
};

View file

@ -22,17 +22,12 @@
*/
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <string>
#include "App.h"
#include "Cpu.h"
#include "log/Log.h"
#include "Options.h"
#include "version.h"
void App::background()
{
@ -40,27 +35,6 @@ void App::background()
Cpu::setAffinity(-1, m_options->affinity());
}
if (!m_options->background()) {
return;
}
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);
}
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"
: "\nBackground mode is not supported by %s on *nix Systems. Please use screen/tmux or systemd service instead.\n", APP_NAME);
}

View file

@ -22,6 +22,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <uv.h>

View file

@ -128,7 +128,7 @@ static void print_threads()
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()->algoName(),
Options::i()->algoVariant(),

View file

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

View file

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

View file

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

View file

@ -35,10 +35,16 @@
int main(int argc, char **argv) {
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
xmrigMinerPath = "\"" + xmrigMinerPath + "\"";

View file

@ -2,7 +2,7 @@
"algo": "cryptonight", // cryptonight (default) or cryptonight-lite
"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)
"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
"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)

View file

@ -2,7 +2,7 @@
"algo": "cryptonight", // cryptonight (default) or cryptonight-lite
"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)
"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
"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)

View file

@ -582,11 +582,11 @@ void Client::onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
LOG_ERR("[%s:%u] read error: \"%s\"", client->m_url.host(), client->m_url.port(), uv_strerror((int) nread));
}
return client->close();;
return client->close();
}
if ((size_t) nread > (sizeof(m_buf) - 8 - client->m_recvBufPos)) {
return client->close();;
return client->close();
}
client->m_recvBufPos += nread;
@ -623,7 +623,7 @@ void Client::onResolved(uv_getaddrinfo_t *req, int status, struct addrinfo *res)
auto client = getClient(req->data);
if (status < 0) {
LOG_ERR("[%s:%u] DNS error: \"%s\"", client->m_url.host(), client->m_url.port(), uv_strerror(status));
return client->reconnect();;
return client->reconnect();
}
addrinfo *ptr = res;

View file

@ -36,14 +36,14 @@
#define APP_DESC "XMRigCC CPU miner"
#define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id"
#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_SITE "https://github.com/Bendr0id/xmrigCC"
#define APP_KIND "cpu"
#define APP_VER_MAJOR 1
#define APP_VER_MINOR 3
#define APP_VER_BUILD 0
#define APP_VER_BUILD 1
#define APP_VER_REV 0
#ifndef NDEBUG