mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-17 00:07:47 +00:00
StratumServer: added avg effort and number of shares to status
This commit is contained in:
parent
4ac08ac10d
commit
bb8ff24db8
2 changed files with 21 additions and 2 deletions
|
@ -46,6 +46,8 @@ StratumServer::StratumServer(p2pool* pool)
|
|||
, m_hashrateDataTail_15m(0)
|
||||
, m_hashrateDataTail_1h(0)
|
||||
, m_hashrateDataTail_24h(0)
|
||||
, m_cumulativeFoundSharesDiff(0.0)
|
||||
, m_totalFoundShares(0)
|
||||
{
|
||||
m_hashrateData[0] = { time(nullptr), 0 };
|
||||
|
||||
|
@ -379,11 +381,18 @@ void StratumServer::print_stratum_status() const
|
|||
const uint64_t hashrate_1h = (dt_1h > 0) ? (hashes_1h / dt_1h ) : 0;
|
||||
const uint64_t hashrate_24h = (dt_24h > 0) ? (hashes_24h / dt_24h) : 0;
|
||||
|
||||
double average_effort = 0.0;
|
||||
if (m_cumulativeHashesAtLastShare > 0) {
|
||||
average_effort = m_cumulativeFoundSharesDiff * 100.0 / static_cast<double>(m_cumulativeHashesAtLastShare);
|
||||
}
|
||||
|
||||
LOGINFO(0, "status" <<
|
||||
"\nHashrate (15m est) = " << log::Hashrate(hashrate_15m) <<
|
||||
"\nHashrate (1h est) = " << log::Hashrate(hashrate_1h) <<
|
||||
"\nHashrate (24h est) = " << log::Hashrate(hashrate_24h) <<
|
||||
"\nTotal hashes = " << total_hashes <<
|
||||
"\nShares found = " << m_totalFoundShares <<
|
||||
"\nAverage effort = " << average_effort << '%' <<
|
||||
"\nCurrent effort = " << static_cast<double>(hashes_since_last_share) * 100.0 / m_pool->side_chain().difficulty().to_double() << '%' <<
|
||||
"\nConnections = " << m_numConnections << " (" << m_numIncomingConnections << " incoming)"
|
||||
);
|
||||
|
@ -572,8 +581,15 @@ void StratumServer::on_share_found(uv_work_t* req)
|
|||
return;
|
||||
}
|
||||
|
||||
LOGINFO(0, log::Green() << "SHARE FOUND at mainchain height " << height);
|
||||
server->m_cumulativeHashesAtLastShare = server->m_cumulativeHashes;
|
||||
const uint64_t n = server->m_cumulativeHashes;
|
||||
const double diff = sidechain_difficulty.to_double();
|
||||
const double effort = static_cast<double>(n - server->m_cumulativeHashesAtLastShare) * 100.0 / diff;
|
||||
server->m_cumulativeHashesAtLastShare = n;
|
||||
|
||||
server->m_cumulativeFoundSharesDiff += diff;
|
||||
++server->m_totalFoundShares;
|
||||
|
||||
LOGINFO(0, log::Green() << "SHARE FOUND at mainchain height " << height << " with effort " << effort << '%');
|
||||
|
||||
if (mainchain_solution) {
|
||||
pool->submit_block_async(share->m_templateId, share->m_nonce, share->m_extraNonce);
|
||||
|
|
|
@ -148,6 +148,9 @@ private:
|
|||
uint64_t m_hashrateDataTail_1h;
|
||||
uint64_t m_hashrateDataTail_24h;
|
||||
|
||||
double m_cumulativeFoundSharesDiff;
|
||||
uint32_t m_totalFoundShares;
|
||||
|
||||
void update_hashrate_data(uint64_t target);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue