daemon mode feature
This commit is contained in:
parent
a6e6dd2940
commit
654d82d125
|
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
||||||
if(strlen(jconf::inst()->GetOutputFile()) != 0)
|
if(strlen(jconf::inst()->GetOutputFile()) != 0)
|
||||||
printer::inst()->open_logfile(jconf::inst()->GetOutputFile());
|
printer::inst()->open_logfile(jconf::inst()->GetOutputFile());
|
||||||
|
|
||||||
executor::inst()->ex_start();
|
executor::inst()->ex_start(jconf::inst()->DaemonMode());
|
||||||
|
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
uint64_t lastTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
|
uint64_t lastTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
|
||||||
|
|
|
@ -87,6 +87,14 @@
|
||||||
*/
|
*/
|
||||||
"h_print_time" : 60,
|
"h_print_time" : 60,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Daemon mode
|
||||||
|
*
|
||||||
|
* If you are running the process in the background and you don't need the keyboard reports, set this to true.
|
||||||
|
* This should solve the hashrate problems on some emulated terminals.
|
||||||
|
*/
|
||||||
|
"daemon_mode" : false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output file
|
* Output file
|
||||||
*
|
*
|
||||||
|
|
|
@ -49,7 +49,6 @@ executor* executor::oInst = NULL;
|
||||||
|
|
||||||
executor::executor()
|
executor::executor()
|
||||||
{
|
{
|
||||||
my_thd = nullptr;
|
|
||||||
cpu_ctx = (cryptonight_ctx*)_mm_malloc(sizeof(cryptonight_ctx), 4096);
|
cpu_ctx = (cryptonight_ctx*)_mm_malloc(sizeof(cryptonight_ctx), 4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ public:
|
||||||
return oInst;
|
return oInst;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ex_start() { my_thd = new std::thread(&executor::ex_main, this); }
|
void ex_start(bool daemon) { daemon ? ex_main() : std::thread(&executor::ex_main, this).detach(); }
|
||||||
void ex_main();
|
|
||||||
|
|
||||||
void get_http_report(ex_event_name ev_id, std::string& data);
|
void get_http_report(ex_event_name ev_id, std::string& data);
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@ private:
|
||||||
|
|
||||||
telemetry* telem;
|
telemetry* telem;
|
||||||
std::vector<minethd*>* pvThreads;
|
std::vector<minethd*>* pvThreads;
|
||||||
std::thread* my_thd;
|
|
||||||
|
|
||||||
size_t current_pool_id;
|
size_t current_pool_id;
|
||||||
|
|
||||||
|
@ -71,6 +69,8 @@ private:
|
||||||
executor();
|
executor();
|
||||||
static executor* oInst;
|
static executor* oInst;
|
||||||
|
|
||||||
|
void ex_main();
|
||||||
|
|
||||||
void ex_clock_thd();
|
void ex_clock_thd();
|
||||||
void pool_connect(jpsock* pool);
|
void pool_connect(jpsock* pool);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ using namespace rapidjson;
|
||||||
enum configEnum { iGpuThreadNum, aGpuThreadsConf, iPlatformIdx,
|
enum configEnum { iGpuThreadNum, aGpuThreadsConf, iPlatformIdx,
|
||||||
bTlsMode, bTlsSecureAlgo, sTlsFingerprint, sPoolAddr, sWalletAddr, sPoolPwd,
|
bTlsMode, bTlsSecureAlgo, sTlsFingerprint, sPoolAddr, sWalletAddr, sPoolPwd,
|
||||||
iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, iAutohashTime,
|
iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, iAutohashTime,
|
||||||
sOutputFile, iHttpdPort, bPreferIpv4 };
|
bDaemonMode, sOutputFile, iHttpdPort, bPreferIpv4 };
|
||||||
|
|
||||||
struct configVal {
|
struct configVal {
|
||||||
configEnum iName;
|
configEnum iName;
|
||||||
|
@ -72,6 +72,7 @@ configVal oConfigValues[] = {
|
||||||
{ iGiveUpLimit, "giveup_limit", kNumberType },
|
{ iGiveUpLimit, "giveup_limit", kNumberType },
|
||||||
{ iVerboseLevel, "verbose_level", kNumberType },
|
{ iVerboseLevel, "verbose_level", kNumberType },
|
||||||
{ iAutohashTime, "h_print_time", kNumberType },
|
{ iAutohashTime, "h_print_time", kNumberType },
|
||||||
|
{ bDaemonMode, "daemon_mode", kTrueType },
|
||||||
{ sOutputFile, "output_file", kStringType },
|
{ sOutputFile, "output_file", kStringType },
|
||||||
{ iHttpdPort, "httpd_port", kNumberType },
|
{ iHttpdPort, "httpd_port", kNumberType },
|
||||||
{ bPreferIpv4, "prefer_ipv4", kTrueType }
|
{ bPreferIpv4, "prefer_ipv4", kTrueType }
|
||||||
|
@ -220,6 +221,11 @@ uint16_t jconf::GetHttpdPort()
|
||||||
return prv->configValues[iHttpdPort]->GetUint();
|
return prv->configValues[iHttpdPort]->GetUint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool jconf::DaemonMode()
|
||||||
|
{
|
||||||
|
return prv->configValues[bDaemonMode]->GetBool();
|
||||||
|
}
|
||||||
|
|
||||||
const char* jconf::GetOutputFile()
|
const char* jconf::GetOutputFile()
|
||||||
{
|
{
|
||||||
return prv->configValues[sOutputFile]->GetString();
|
return prv->configValues[sOutputFile]->GetString();
|
||||||
|
|
Loading…
Reference in New Issue