Add option "--print-time".
This commit is contained in:
parent
4e4c54314b
commit
fed163568e
5 changed files with 35 additions and 2 deletions
|
@ -58,6 +58,15 @@ Hashrate::Hashrate(int threads) :
|
|||
memset(m_counts[0], 0, sizeof(uint64_t) * kBucketSize);
|
||||
memset(m_timestamps[0], 0, sizeof(uint64_t) * kBucketSize);
|
||||
}
|
||||
|
||||
const int printTime = Options::i()->printTime();
|
||||
|
||||
if (printTime > 0) {
|
||||
uv_timer_init(uv_default_loop(), &m_timer);
|
||||
m_timer.data = this;
|
||||
|
||||
uv_timer_start(&m_timer, Hashrate::onReport, (printTime + 4) * 1000, printTime * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,3 +168,9 @@ void Hashrate::updateHighest()
|
|||
m_highest = highest;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Hashrate::onReport(uv_timer_t *handle)
|
||||
{
|
||||
static_cast<Hashrate*>(handle->data)->print();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue