Add average hash rate to metrics
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
AtomicCounter transactionsValidated;
|
AtomicCounter transactionsValidated;
|
||||||
AtomicCounter ehSolverRuns;
|
AtomicCounter ehSolverRuns;
|
||||||
|
AtomicCounter solutionTargetChecks;
|
||||||
AtomicCounter minedBlocks;
|
AtomicCounter minedBlocks;
|
||||||
|
|
||||||
boost::synchronized_value<std::list<std::string>> messageBox;
|
boost::synchronized_value<std::list<std::string>> messageBox;
|
||||||
@@ -111,8 +112,11 @@ int printMetrics(size_t cols, int64_t nStart, bool mining)
|
|||||||
std::cout << "- " << strprintf(_("You have validated %d transactions."), transactionsValidated.get()) << std::endl;
|
std::cout << "- " << strprintf(_("You have validated %d transactions."), transactionsValidated.get()) << std::endl;
|
||||||
|
|
||||||
if (mining) {
|
if (mining) {
|
||||||
|
double hps = uptime > 0 ? (double)solutionTargetChecks.get() / uptime : 0;
|
||||||
|
std::string strHps = strprintf("%.4f H/s", hps);
|
||||||
|
std::cout << "- " << strprintf(_("You have contributed %s on average to the network hash rate."), strHps) << std::endl;
|
||||||
std::cout << "- " << strprintf(_("You have completed %d Equihash solver runs."), ehSolverRuns.get()) << std::endl;
|
std::cout << "- " << strprintf(_("You have completed %d Equihash solver runs."), ehSolverRuns.get()) << std::endl;
|
||||||
lines++;
|
lines += 2;
|
||||||
|
|
||||||
int mined = minedBlocks.get();
|
int mined = minedBlocks.get();
|
||||||
if (mined > 0) {
|
if (mined > 0) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct AtomicCounter {
|
|||||||
|
|
||||||
extern AtomicCounter transactionsValidated;
|
extern AtomicCounter transactionsValidated;
|
||||||
extern AtomicCounter ehSolverRuns;
|
extern AtomicCounter ehSolverRuns;
|
||||||
|
extern AtomicCounter solutionTargetChecks;
|
||||||
extern AtomicCounter minedBlocks;
|
extern AtomicCounter minedBlocks;
|
||||||
|
|
||||||
void ConnectMetricsScreen();
|
void ConnectMetricsScreen();
|
||||||
|
|||||||
@@ -541,6 +541,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
// Write the solution to the hash and compute the result.
|
// Write the solution to the hash and compute the result.
|
||||||
LogPrint("pow", "- Checking solution against target\n");
|
LogPrint("pow", "- Checking solution against target\n");
|
||||||
pblock->nSolution = soln;
|
pblock->nSolution = soln;
|
||||||
|
solutionTargetChecks.increment();
|
||||||
|
|
||||||
if (UintToArith256(pblock->GetHash()) > hashTarget) {
|
if (UintToArith256(pblock->GetHash()) > hashTarget) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ Value generate(const Array& params, bool fHelp)
|
|||||||
std::function<bool(std::vector<unsigned char>)> validBlock =
|
std::function<bool(std::vector<unsigned char>)> validBlock =
|
||||||
[&pblock](std::vector<unsigned char> soln) {
|
[&pblock](std::vector<unsigned char> soln) {
|
||||||
pblock->nSolution = soln;
|
pblock->nSolution = soln;
|
||||||
|
solutionTargetChecks.increment();
|
||||||
return CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus());
|
return CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus());
|
||||||
};
|
};
|
||||||
bool found = EhBasicSolveUncancellable(n, k, curr_state, validBlock);
|
bool found = EhBasicSolveUncancellable(n, k, curr_state, validBlock);
|
||||||
|
|||||||
Reference in New Issue
Block a user