add log aporximation to metrics solution rates

This commit is contained in:
Alfredo Garcia 2020-06-13 15:12:05 -03:00
parent 552482a404
commit 7db6e37b40
1 changed files with 7 additions and 2 deletions

View File

@ -276,6 +276,7 @@ int printStats(bool isScreen, bool mining)
int64_t currentHeadersTime;
size_t connections;
int64_t netsolps;
double netsolpsLog = 1.0;
const Consensus::Params& params = Params().GetConsensus();
{
LOCK2(cs_main, cs_vNodes);
@ -284,8 +285,12 @@ int printStats(bool isScreen, bool mining)
currentHeadersTime = pindexBestHeader ? pindexBestHeader->nTime : 0;
connections = vNodes.size();
netsolps = GetNetworkHashPS(120, -1);
netsolpsLog = std::log2(netsolps);
}
auto localsolps = GetLocalSolPS();
double localsolpsLog = 0.0;
if (localsolps > 0)
localsolpsLog = std::log2(localsolps);
if (IsInitialBlockDownload(Params())) {
if (fReindex) {
@ -342,9 +347,9 @@ int printStats(bool isScreen, bool mining)
}
std::cout << " " << _("Next upgrade") << " | " << strUpgradeTime << std::endl;
std::cout << " " << _("Connections") << " | " << connections << std::endl;
std::cout << " " << _("Network solution rate") << " | " << netsolps << " Sol/s" << std::endl;
std::cout << " " << _("Network solution rate") << " | " << strprintf("~ 2^%.4f Sol/s", netsolpsLog) << std::endl;
if (mining && miningTimer.running()) {
std::cout << " " << _("Local solution rate") << " | " << strprintf("%.4f Sol/s", localsolps) << std::endl;
std::cout << " " << _("Local solution rate") << " | " << strprintf("~ 2^%.4f Sol/s", localsolpsLog) << std::endl;
lines++;
}
std::cout << std::endl;