Browse Source

solution stats

cl-refactor
Genoil 9 years ago
parent
commit
34b856bc2b
  1. 2
      CMakeLists.txt
  2. 14
      ethminer/MinerAux.h
  3. 20
      libethcore/Farm.h
  4. 22
      libethcore/Miner.h
  5. 13
      libstratum/EthStratumClient.cpp

2
CMakeLists.txt

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 2.8.12)
set(PROJECT_VERSION "0.9.41")
set(GENOIL_VERSION "1.0.7")
set(GENOIL_VERSION "1.0.8")
if (${CMAKE_VERSION} VERSION_GREATER 3.0)
cmake_policy(SET CMP0042 OLD) # fix MACOSX_RPATH
cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project()

14
ethminer/MinerAux.h

@ -940,13 +940,19 @@ private:
if (EthashAux::eval(current.seedHash, current.headerHash, solution.nonce).value < current.boundary)
{
bool ok = prpc->eth_submitWork("0x" + toString(solution.nonce), "0x" + toString(current.headerHash), "0x" + toString(solution.mixHash));
if (ok)
if (ok) {
cnote << "B-) Submitted and accepted.";
else
f.acceptedSolution();
}
else {
cwarn << ":-( Not accepted.";
f.rejectedSolution();
}
else
}
else {
f.failedSolution();
cwarn << "FAILURE: GPU gave incorrect result!";
}
current.reset();
}
catch (jsonrpc::JsonRpcException&)
@ -1026,7 +1032,7 @@ private:
if (client.isConnected())
{
if (client.current())
minelog << "Mining on PoWhash" << client.currentHeaderHash() << ": " << mp;
minelog << "Mining on PoWhash" << client.currentHeaderHash() << ": " << mp << f.getSolutionStats();
else
minelog << "Waiting for work package...";
}

20
libethcore/Farm.h

@ -146,6 +146,22 @@ public:
resetTimer();
}
SolutionStats getSolutionStats() {
return m_solutionStats;
}
void failedSolution() {
m_solutionStats.failed();
}
void acceptedSolution() {
m_solutionStats.accepted();
}
void rejectedSolution() {
m_solutionStats.rejected();
}
using SolutionFound = std::function<bool(Solution const&)>;
/**
@ -200,6 +216,10 @@ private:
std::map<std::string, SealerDescriptor> m_sealers;
std::string m_lastSealer;
mutable SharedMutex x_solutionStats;
mutable SolutionStats m_solutionStats;
};
}

22
libethcore/Miner.h

@ -54,6 +54,28 @@ inline std::ostream& operator<<(std::ostream& _out, WorkingProgress _p)
return _out;
}
class SolutionStats {
public:
void accepted() { accepts++; }
void rejected() { rejects++; }
void failed() { failures++; }
void reset() { accepts = rejects = failures = 0; }
unsigned getAccepts() { return accepts; }
unsigned getRejects() { return rejects; }
unsigned getFailures() { return failures; }
private:
unsigned accepts = 0;
unsigned rejects = 0;
unsigned failures = 0;
};
inline std::ostream& operator<<(std::ostream& os, SolutionStats s)
{
return os << "[A" << s.getAccepts() << ":R" << s.getRejects() << ":F" << s.getFailures() << "]";
}
template <class PoW> class GenericMiner;
/**

13
libstratum/EthStratumClient.cpp

@ -259,10 +259,14 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
cnote << "Authorized worker " << p_active->user;
break;
case 4:
if (responseObject.get("result", false).asBool())
if (responseObject.get("result", false).asBool()) {
cnote << "B-) Submitted and accepted.";
else
p_farm->acceptedSolution();
}
else {
cwarn << ":-( Not accepted.";
p_farm->rejectedSolution();
}
break;
default:
string method = responseObject.get("method", "").asString();
@ -346,9 +350,10 @@ bool EthStratumClient::submit(EthashProofOfWork::Solution solution) {
boost::asio::placeholders::error));
return true;
}
else
else {
cwarn << "FAILURE: GPU gave incorrect result!";
p_farm->rejectedSolution();
}
return false;
}

Loading…
Cancel
Save