daemon mode feature

This commit is contained in:
fireice-uk 2017-05-26 19:36:38 +01:00
parent a6e6dd2940
commit 654d82d125
6 changed files with 21 additions and 6 deletions

View File

@ -140,7 +140,7 @@ int main(int argc, char *argv[])
if(strlen(jconf::inst()->GetOutputFile()) != 0)
printer::inst()->open_logfile(jconf::inst()->GetOutputFile());
executor::inst()->ex_start();
executor::inst()->ex_start(jconf::inst()->DaemonMode());
using namespace std::chrono;
uint64_t lastTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();

View File

@ -87,6 +87,14 @@
*/
"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
*

View File

@ -49,7 +49,6 @@ executor* executor::oInst = NULL;
executor::executor()
{
my_thd = nullptr;
cpu_ctx = (cryptonight_ctx*)_mm_malloc(sizeof(cryptonight_ctx), 4096);
}

View File

@ -21,8 +21,7 @@ public:
return oInst;
};
void ex_start() { my_thd = new std::thread(&executor::ex_main, this); }
void ex_main();
void ex_start(bool daemon) { daemon ? ex_main() : std::thread(&executor::ex_main, this).detach(); }
void get_http_report(ex_event_name ev_id, std::string& data);
@ -57,7 +56,6 @@ private:
telemetry* telem;
std::vector<minethd*>* pvThreads;
std::thread* my_thd;
size_t current_pool_id;
@ -71,6 +69,8 @@ private:
executor();
static executor* oInst;
void ex_main();
void ex_clock_thd();
void pool_connect(jpsock* pool);

View File

@ -48,7 +48,7 @@ using namespace rapidjson;
enum configEnum { iGpuThreadNum, aGpuThreadsConf, iPlatformIdx,
bTlsMode, bTlsSecureAlgo, sTlsFingerprint, sPoolAddr, sWalletAddr, sPoolPwd,
iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, iAutohashTime,
sOutputFile, iHttpdPort, bPreferIpv4 };
bDaemonMode, sOutputFile, iHttpdPort, bPreferIpv4 };
struct configVal {
configEnum iName;
@ -72,6 +72,7 @@ configVal oConfigValues[] = {
{ iGiveUpLimit, "giveup_limit", kNumberType },
{ iVerboseLevel, "verbose_level", kNumberType },
{ iAutohashTime, "h_print_time", kNumberType },
{ bDaemonMode, "daemon_mode", kTrueType },
{ sOutputFile, "output_file", kStringType },
{ iHttpdPort, "httpd_port", kNumberType },
{ bPreferIpv4, "prefer_ipv4", kTrueType }
@ -220,6 +221,11 @@ uint16_t jconf::GetHttpdPort()
return prv->configValues[iHttpdPort]->GetUint();
}
bool jconf::DaemonMode()
{
return prv->configValues[bDaemonMode]->GetBool();
}
const char* jconf::GetOutputFile()
{
return prv->configValues[sOutputFile]->GetString();

View File

@ -44,6 +44,8 @@ public:
uint16_t GetHttpdPort();
bool DaemonMode();
bool PreferIpv4();
inline bool HaveHardwareAes() { return bHaveAes; }