summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.md6
-rw-r--r--config.txt14
-rw-r--r--console.h2
-rw-r--r--executor.cpp46
-rw-r--r--executor.h19
-rw-r--r--jconf.cpp16
-rw-r--r--jconf.h5
-rw-r--r--msgstruct.h3
-rw-r--r--xmr-stak-cpu.cbp6
10 files changed, 86 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore
index ecea807..8356f53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ bin/
obj/
xmr-stak-cpu.layout
xmr-stak-cpu.depend
+config-debug.txt
diff --git a/README.md b/README.md
index d025502..23a3387 100644
--- a/README.md
+++ b/README.md
@@ -166,6 +166,12 @@ Reference: http://rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?pid=259791#pid
*Warning: do not download ntrights.exe from any other site other then the offical Microsoft download page.*
+**VirtualAlloc failed**
+
+If you set up the user rights properly (see above), and your system has 4-8GB of RAM (50%+ use), there is a significant chance that there simply won't be a large enough chunk of contiguous memory because Windows is fairly bad at mitigating memory fragmentation.
+
+If that happens, disable all auto-staring applications and run the miner after a reboot.
+
**msvcp140.dll and vcruntime140.dll not available errors**
Download and install this [runtime package](https://www.microsoft.com/en-us/download/details.aspx?id=48145) from Microsoft. *Warning: Do NOT use "missing dll" sites - dll's are exe files with another name, and it is a fairly safe bet that any dll on a shady site like that will be trojaned. Please download offical runtimes from Microsoft above.*
diff --git a/config.txt b/config.txt
index b70f0fa..dba5723 100644
--- a/config.txt
+++ b/config.txt
@@ -21,6 +21,11 @@
/*
* LARGE PAGE SUPPORT
+ * Lare pages need a properly set up OS. It can be difficult if you are not used to systems administation,
+ * but the performace results are worth the trouble - you will get around 20% boost. Slow memory mode is
+ * meant as a backup, you won't get stellar results there. If you are running into trouble, especially
+ * on Windows, please read the common issues in the README.
+ *
* By default we will try to allocate large pages. This means you need to "Run As Administrator" on Windows.
* You need to edit your system's group policies to enable locking large pages. Here are the steps from MSDN
*
@@ -92,10 +97,19 @@
* 1 - Print intro, connection event, disconnect event
* 2 - All of level 1, and new job (block) event if the difficulty is different from the last job
* 3 - All of level 1, and new job (block) event in all cases, result submission event.
+ * 4 - All of level 3, and automatic hashrate report printing
*/
"verbose_level" : 3,
/*
+ * Automatic hashrate report
+ *
+ * h_print_time - How often, in seconds, should we print a hashrate report if verbose_level is set to 4.
+ * This option has no effect if verbose_level is not 4.
+ */
+"h_print_time" : 60,
+
+/*
* prefer_ipv4 - IPv6 preference. If the host is available on both IPv4 and IPv6 net, which one should be choose?
* This setting will only be needed in 2020's. No need to worry about it now.
*/
diff --git a/console.h b/console.h
index 40b99e1..5c86830 100644
--- a/console.h
+++ b/console.h
@@ -17,7 +17,7 @@ inline long long unsigned int int_port(size_t i)
return i;
}
-enum verbosity : size_t { L0 = 0, L1 = 1, L2 = 2, L3 = 3, LINF = 100};
+enum verbosity : size_t { L0 = 0, L1 = 1, L2 = 2, L3 = 3, L4 = 4, LINF = 100};
class printer
{
diff --git a/executor.cpp b/executor.cpp
index 8da2a23..16a5a90 100644
--- a/executor.cpp
+++ b/executor.cpp
@@ -33,6 +33,12 @@ executor::executor()
my_thd = nullptr;
}
+void executor::push_timed_event(ex_event&& ev, size_t sec)
+{
+ std::unique_lock<std::mutex> lck(timed_event_mutex);
+ lTimedEvents.emplace_back(std::move(ev), sec_to_ticks(sec));
+}
+
void executor::ex_clock_thd()
{
size_t iSwitchPeriod = sec_to_ticks(iDevDonatePeriod);
@@ -52,19 +58,21 @@ void executor::ex_clock_thd()
push_event(ex_event(EV_PERF_TICK));
- if(iReconnectCountdown != 0)
+ // Service timed events
+ std::unique_lock<std::mutex> lck(timed_event_mutex);
+ std::list<timed_event>::iterator ev = lTimedEvents.begin();
+ while (ev != lTimedEvents.end())
{
- iReconnectCountdown--;
- if(iReconnectCountdown == 0)
- push_event(ex_event(EV_RECONNECT, usr_pool_id));
- }
-
- if(iDevDisconnectCountdown != 0)
- {
- iDevDisconnectCountdown--;
- if(iDevDisconnectCountdown == 0)
- push_event(ex_event(EV_DEV_POOL_EXIT));
+ ev->ticks_left--;
+ if(ev->ticks_left == 0)
+ {
+ push_event(std::move(ev->event));
+ ev = lTimedEvents.erase(ev);
+ }
+ else
+ ev++;
}
+ lck.unlock();
if(iDevPortion == 0)
continue;
@@ -90,7 +98,7 @@ void executor::sched_reconnect()
auto work = minethd::miner_work();
minethd::switch_work(work);
- iReconnectCountdown = sec_to_ticks(rt);
+ push_timed_event(ex_event(EV_RECONNECT, usr_pool_id), rt);
}
void executor::log_socket_error(std::string&& sError)
@@ -312,7 +320,7 @@ void executor::on_switch_pool(size_t pool_id)
minethd::switch_work(oWork);
if(dev_pool->is_running())
- iDevDisconnectCountdown = sec_to_ticks(5);
+ push_timed_event(ex_event(EV_DEV_POOL_EXIT), 5);
}
}
@@ -320,9 +328,6 @@ void executor::ex_main()
{
assert(1000 % iTickTime == 0);
- iReconnectCountdown = 0;
- iDevDisconnectCountdown = 0;
-
minethd::miner_work oWork = minethd::miner_work();
pvThreads = minethd::thread_starter(oWork);
telem = new telemetry(pvThreads->size());
@@ -341,6 +346,10 @@ void executor::ex_main()
// be here even if our first result is a failure
vMineResults.emplace_back();
+ // If the user requested it, start the autohash printer
+ if(jconf::inst()->GetVerboseLevel() >= 4)
+ push_timed_event(ex_event(EV_HASHRATE_LOOP), jconf::inst()->GetAutohashTime());
+
size_t cnt = 0, i;
while (true)
{
@@ -403,6 +412,11 @@ void executor::ex_main()
connection_report();
break;
+ case EV_HASHRATE_LOOP:
+ hashrate_report();
+ push_timed_event(ex_event(EV_HASHRATE_LOOP), jconf::inst()->GetAutohashTime());
+ break;
+
case EV_INVALID_VAL:
default:
assert(false);
diff --git a/executor.h b/executor.h
index ab4f605..b279bdb 100644
--- a/executor.h
+++ b/executor.h
@@ -3,6 +3,7 @@
#include "msgstruct.h"
#include <atomic>
#include <array>
+#include <list>
class jpsock;
class minethd;
@@ -21,10 +22,20 @@ public:
void ex_main();
inline void push_event(ex_event&& ev) { oEventQ.push(std::move(ev)); }
+ void push_timed_event(ex_event&& ev, size_t sec);
private:
+ struct timed_event
+ {
+ ex_event event;
+ size_t ticks_left;
+
+ timed_event(ex_event&& ev, size_t ticks) : event(std::move(ev)), ticks_left(ticks) {}
+ };
+
// In miliseconds, has to divide a second (1000ms) into an integer number
constexpr static size_t iTickTime = 500;
+
// Dev donation time period in seconds. 100 minutes by default.
// We will divide up this period according to the config setting
constexpr static size_t iDevDonatePeriod = 100 * 60;
@@ -33,15 +44,17 @@ private:
constexpr static size_t dev_pool_id = 1;
constexpr static size_t usr_pool_id = 2;
- std::atomic<size_t> iReconnectCountdown;
+ //std::atomic<size_t> iDevDisconnectCountdown;
+ //std::atomic<size_t> iReconnectCountdown;
+ std::list<timed_event> lTimedEvents;
+ std::mutex timed_event_mutex;
thdq<ex_event> oEventQ;
telemetry* telem;
std::vector<minethd*>* pvThreads;
std::thread* my_thd;
- size_t current_pool_id;
- std::atomic<size_t> iDevDisconnectCountdown;
+ size_t current_pool_id;
jpsock* usr_pool;
jpsock* dev_pool;
diff --git a/jconf.cpp b/jconf.cpp
index dc87088..12df8d6 100644
--- a/jconf.cpp
+++ b/jconf.cpp
@@ -35,7 +35,7 @@ using namespace rapidjson;
* This enum needs to match index in oConfigValues, otherwise we will get a runtime error
*/
enum configEnum { iCpuThreadNum, aCpuThreadsConf, sUseSlowMem, sPoolAddr,
- sWalletAddr, sPoolPwd, iCallTimeout, iNetRetry, iVerboseLevel, bPreferIpv4 };
+ sWalletAddr, sPoolPwd, iCallTimeout, iNetRetry, iVerboseLevel, iAutohashTime, bPreferIpv4 };
struct configVal {
configEnum iName;
@@ -54,6 +54,7 @@ configVal oConfigValues[] = {
{ iCallTimeout, "call_timeout", kNumberType },
{ iNetRetry, "retry_time", kNumberType },
{ iVerboseLevel, "verbose_level", kNumberType },
+ { iAutohashTime, "h_print_time", kNumberType },
{ bPreferIpv4, "prefer_ipv4", kTrueType }
};
@@ -174,9 +175,14 @@ uint64_t jconf::GetNetRetry()
return prv->configValues[iNetRetry]->GetUint64();
}
-int64_t jconf::GetVerboseLevel()
+uint64_t jconf::GetVerboseLevel()
{
- return prv->configValues[iVerboseLevel]->GetInt64();
+ return prv->configValues[iVerboseLevel]->GetUint64();
+}
+
+uint64_t jconf::GetAutohashTime()
+{
+ return prv->configValues[iAutohashTime]->GetUint64();
}
bool jconf::parse_config(const char* sFilename)
@@ -290,10 +296,10 @@ bool jconf::parse_config(const char* sFilename)
return false;
}
- if(!prv->configValues[iVerboseLevel]->IsInt64())
+ if(!prv->configValues[iVerboseLevel]->IsUint64() || !prv->configValues[iAutohashTime]->IsUint64())
{
printer::inst()->print_msg(L0,
- "Invalid config file. verbose_level has to be an integer.");
+ "Invalid config file. verbose_level and h_print_time need to be positive integers.");
return false;
}
diff --git a/jconf.h b/jconf.h
index 83bb0bb..0a2a7f8 100644
--- a/jconf.h
+++ b/jconf.h
@@ -35,9 +35,8 @@ public:
const char* GetPoolPwd();
const char* GetWalletAddress();
- int64_t GetVerboseLevel();
-
- double GetDonationLevel();
+ uint64_t GetVerboseLevel();
+ uint64_t GetAutohashTime();
uint64_t GetCallTimeout();
uint64_t GetNetRetry();
diff --git a/msgstruct.h b/msgstruct.h
index fc9f6ff..248ee16 100644
--- a/msgstruct.h
+++ b/msgstruct.h
@@ -39,7 +39,8 @@ struct job_result
enum ex_event_name { EV_INVALID_VAL, EV_SOCK_READY, EV_SOCK_ERROR,
EV_POOL_HAVE_JOB, EV_MINER_HAVE_RESULT, EV_PERF_TICK, EV_RECONNECT,
- EV_SWITCH_POOL, EV_DEV_POOL_EXIT, EV_USR_HASHRATE, EV_USR_RESULTS, EV_USR_CONNSTAT };
+ EV_SWITCH_POOL, EV_DEV_POOL_EXIT, EV_USR_HASHRATE, EV_USR_RESULTS, EV_USR_CONNSTAT,
+ EV_HASHRATE_LOOP };
/*
This is how I learned to stop worrying and love c++11 =).
diff --git a/xmr-stak-cpu.cbp b/xmr-stak-cpu.cbp
index 3bb3732..f362ca3 100644
--- a/xmr-stak-cpu.cbp
+++ b/xmr-stak-cpu.cbp
@@ -11,7 +11,7 @@
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
- <Option parameters="config.jscfg" />
+ <Option parameters="config-debug.txt" />
<Compiler>
<Add option="-march=corei7-avx" />
<Add option="-std=c++11" />
@@ -29,7 +29,7 @@
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
- <Option parameters="config.jscfg" />
+ <Option parameters="config-debug.txt" />
<Compiler>
<Add option="-march=westmere" />
<Add option="-O3" />
@@ -49,7 +49,7 @@
<Option object_output="obj/Release_test/" />
<Option type="1" />
<Option compiler="gcc" />
- <Option parameters="config.jscfg" />
+ <Option parameters="config-debug.txt" />
<Compiler>
<Add option="-march=westmere" />
<Add option="-O3" />
OpenPOWER on IntegriCloud