#2018-009, Minor adjustments, code comments
This commit is contained in:
parent
bcfd6a5670
commit
4efc1e39f4
4 changed files with 57 additions and 19 deletions
35
src/App.cpp
35
src/App.cpp
|
@ -53,7 +53,12 @@
|
||||||
App *App::m_self = nullptr;
|
App *App::m_self = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : App::~App
|
||||||
|
* SYNOPSIS : App constructor
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
App::App(int argc, char **argv) :
|
App::App(int argc, char **argv) :
|
||||||
m_console(nullptr),
|
m_console(nullptr),
|
||||||
m_httpd(nullptr),
|
m_httpd(nullptr),
|
||||||
|
@ -94,6 +99,13 @@ App::App(int argc, char **argv) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : App::~App
|
||||||
|
* SYNOPSIS : App destructor
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
App::~App()
|
App::~App()
|
||||||
{
|
{
|
||||||
uv_tty_reset_mode();
|
uv_tty_reset_mode();
|
||||||
|
@ -106,6 +118,12 @@ App::~App()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : App::exec()
|
||||||
|
* SYNOPSIS :
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
int App::exec()
|
int App::exec()
|
||||||
{
|
{
|
||||||
if (!m_options) {
|
if (!m_options) {
|
||||||
|
@ -147,7 +165,12 @@ int App::exec()
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : onConsoleCommand(char command)
|
||||||
|
* SYNOPSIS : Process commands from console
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
void App::onConsoleCommand(char command)
|
void App::onConsoleCommand(char command)
|
||||||
{
|
{
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
@ -181,6 +204,12 @@ void App::onConsoleCommand(char command)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : close()
|
||||||
|
* SYNOPSIS : CTRL+C is pressed, exit application
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
void App::close()
|
void App::close()
|
||||||
{
|
{
|
||||||
m_network->stop();
|
m_network->stop();
|
||||||
|
@ -213,3 +242,5 @@ void App::onSignal(uv_signal_t *handle, int signum)
|
||||||
uv_signal_stop(handle);
|
uv_signal_stop(handle);
|
||||||
m_self->close();
|
m_self->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------end of file------------------------------------------------*/
|
||||||
|
|
|
@ -26,11 +26,7 @@
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
include <getopt.h>
|
||||||
# include "getopt/getopt.h"
|
|
||||||
#else
|
|
||||||
# include <getopt.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Cpu.h"
|
#include "Cpu.h"
|
||||||
|
@ -276,7 +272,12 @@ Options::~Options()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : Options::getJSON(const char *fileName, rapidjson::Document &doc)
|
||||||
|
* SYNOPSIS : Open config.json file from working folder
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
bool Options::getJSON(const char *fileName, rapidjson::Document &doc)
|
bool Options::getJSON(const char *fileName, rapidjson::Document &doc)
|
||||||
{
|
{
|
||||||
uv_fs_t req;
|
uv_fs_t req;
|
||||||
|
@ -298,14 +299,20 @@ bool Options::getJSON(const char *fileName, rapidjson::Document &doc)
|
||||||
uv_fs_req_cleanup(&req);
|
uv_fs_req_cleanup(&req);
|
||||||
|
|
||||||
if (doc.HasParseError()) {
|
if (doc.HasParseError()) {
|
||||||
printf("%s:%d: %s\n", fileName, (int) doc.GetErrorOffset(), rapidjson::GetParseError_En(doc.GetParseError()));
|
std::cout << fileName << " " << (int) doc.GetErrorOffset() \
|
||||||
|
<< " " << rapidjson::GetParseError_En(doc.GetParseError()) << '\n"';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return doc.IsObject();
|
return doc.IsObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------
|
||||||
|
* NAME : Options::parseArg(int key, const char *arg)
|
||||||
|
* SYNOPSIS : Arguments parsing
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
---------------------------------------------------------------------*/
|
||||||
bool Options::parseArg(int key, const char *arg)
|
bool Options::parseArg(int key, const char *arg)
|
||||||
{
|
{
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
"cpu-affinity": null, // set process affinity to CPU core(s)
|
"cpu-affinity": null, // set process affinity to CPU core(s)
|
||||||
// mask 3 for cores 0 and 1
|
// mask 3 for cores 0 and 1
|
||||||
// mask 14 for cores 1,2,3
|
// mask 14 for cores 1,2,3
|
||||||
"cpu-priority": 3, // set process priority (0 idle, 2 normal to 5 highest)
|
"cpu-priority": 4, // set process priority (0 idle, 2 normal to 5 highest)
|
||||||
"donate-level": 3, // donate level, mininum 1%
|
"donate-level": 2, // donate level, mininum 1%
|
||||||
"log-file" : "/var/log/xmr_arch64_monero.log", // log all output to a file
|
"log-file" : "/var/log/xmr_arch64_monero.log", // log all output to a file
|
||||||
"max-cpu-usage": 50, // maximum CPU usage for automatic mode, usually limiting factor is CPU cache not this option.
|
"max-cpu-usage": 88, // maximum CPU usage for automatic mode, usually limiting factor is CPU cache not this option.
|
||||||
"print-time": 60, // print hashrate report every N seconds
|
"print-time": 90, // print hashrate report every N seconds
|
||||||
"retries": 5, // number of times to retry before switch to backup server
|
"retries": 5, // number of times to retry before switch to backup server
|
||||||
"retry-pause": 5, // time to pause between retries
|
"retry-pause": 5, // time to pause between retries
|
||||||
"safe": false, // true to safe adjust threads and av settings for current CPU
|
"safe": false, // true to safe adjust threads and av settings for current CPU
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue