v1.0.1 candidate - new more verbose level

This commit is contained in:
fireice-uk
2017-01-11 02:44:28 +00:00
parent 947cb8004f
commit fb6bf3ec4b
10 changed files with 86 additions and 32 deletions
+30 -16
View File
@@ -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);