Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #225 from evilny0/hashratepercard
Browse files Browse the repository at this point in the history
Hashrate printed per card.
  • Loading branch information
chfast committed Aug 16, 2017
2 parents 40eab52 + 822bc77 commit 168e3f7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
13 changes: 9 additions & 4 deletions ethminer/MinerAux.h
Expand Up @@ -775,7 +775,10 @@ class MinerCLI
auto mp = f.miningProgress();
f.resetMiningProgress();
if (current)
minelog << "Mining on" << current.header << ": " << mp << f.getSolutionStats();
{
minelog << "Mining on" << current.header << f.getSolutionStats();
minelog << mp;
}
else
minelog << "Getting work package...";

Expand Down Expand Up @@ -815,7 +818,7 @@ class MinerCLI
{
bool ok = prpc->eth_submitWork("0x" + toHex(solution.nonce), "0x" + toString(solution.headerHash), "0x" + toString(solution.mixHash));
if (ok) {
cnote << "B-) Submitted and accepted.";
cnote << EthLime << "B-) Submitted and accepted." << EthReset;
f.acceptedSolution(false);
}
else {
Expand Down Expand Up @@ -916,7 +919,8 @@ class MinerCLI
{
if (client.current())
{
minelog << "Mining on" << client.currentHeaderHash() << ": " << mp << f.getSolutionStats();
minelog << "Mining on" << client.currentHeaderHash() << f.getSolutionStats();
minelog << mp;
}
else
{
Expand Down Expand Up @@ -955,7 +959,8 @@ class MinerCLI
{
if (client.current())
{
minelog << "Mining on" << client.currentHeaderHash() << ": " << mp << f.getSolutionStats();
minelog << "Mining on" << client.currentHeaderHash() << f.getSolutionStats();
minelog << mp;
}
else if (client.waitState() == MINER_WAIT_STATE_WORK)
{
Expand Down
2 changes: 0 additions & 2 deletions libdevcore/Terminal.h
Expand Up @@ -7,8 +7,6 @@ namespace con

#ifdef _WIN32

#define EthReset "" // Text Reset

#define EthReset "" // Text Reset

// Regular Colors
Expand Down
6 changes: 5 additions & 1 deletion libethcore/Farm.h
Expand Up @@ -138,7 +138,11 @@ class Farm: public FarmFace
{
Guard l2(x_minerWork);
for (auto const& i: m_miners)
p.hashes += i->hashCount();
{
uint64_t minerHashCount = i->hashCount();
p.hashes += minerHashCount;
p.minersHashes.push_back(minerHashCount);
}
}
Guard l(x_progress);
m_progress = p;
Expand Down
16 changes: 13 additions & 3 deletions libethcore/Miner.h
Expand Up @@ -70,14 +70,24 @@ struct WorkingProgress
uint64_t hashes = 0; ///< Total number of hashes computed.
uint64_t ms = 0; ///< Total number of milliseconds of mining thus far.
uint64_t rate() const { return ms == 0 ? 0 : hashes * 1000 / ms; }

std::vector<uint64_t> minersHashes;
uint64_t minerRate(const uint64_t hashCount) const { return ms == 0 ? 0 : hashCount * 1000 / ms; }
};

inline std::ostream& operator<<(std::ostream& _out, WorkingProgress _p)
{
float mh = _p.rate() / 1000000.0f;
char mhs[16];
sprintf(mhs, "%.2f", mh);
_out << std::string(mhs) + "MH/s";
_out << "Total: " << std::fixed << std::setprecision(2) << mh << "MH/s ( ";

int gpuIndex=0;
for (auto const& i: _p.minersHashes)
{
mh = _p.minerRate(i) / 1000000.0f;
_out << EthBlue << gpuIndex++ << ":" << EthReset << std::fixed << std::setprecision(2) << mh << " ";
}
_out << ")";

return _out;
}

Expand Down
2 changes: 1 addition & 1 deletion libstratum/EthStratumClient.cpp
Expand Up @@ -359,7 +359,7 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
break;
case 4:
if (responseObject.get("result", false).asBool()) {
cnote << "B-) Submitted and accepted.";
cnote << EthLime << "B-) Submitted and accepted." << EthReset;
p_farm->acceptedSolution(m_stale);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion libstratum/EthStratumClientV2.cpp
Expand Up @@ -303,7 +303,7 @@ void EthStratumClientV2::processReponse(Json::Value& responseObject)
break;
case 4:
if (responseObject.get("result", false).asBool()) {
cnote << "B-) Submitted and accepted.";
cnote << EthLime << "B-) Submitted and accepted." << EthReset;
p_farm->acceptedSolution(m_stale);
}
else {
Expand Down

0 comments on commit 168e3f7

Please sign in to comment.