37 _out << _p.
rate() <<
" H/s = " << _p.
hashes <<
" hashes / " << (double(_p.
ms) / 1000) <<
" s";
71 template <
class PoW>
class GenericMiner
89 bool const old_exists = !!m_work;
101 else if (!_work && old_exists)
103 Guard l(x_hashCount);
111 unsigned index()
const {
return m_index; }
126 virtual void pause() = 0;
156 uint64_t m_hashCount = 0;
157 mutable Mutex x_hashCount;
160 mutable Mutex x_work;
bool submitProof(Solution const &_s)
Notes that the Miner found a solution.
GenericMiner(ConstructionInfo const &_ci)
GenericFarmFace< PoW > FarmFace
std::ostream & operator<<(std::ostream &_out, BlockHeader const &_bi)
virtual ~GenericFarmFace()
typename PoW::WorkPackage WorkPackage
void accumulateHashes(unsigned _n)
void setWork(WorkPackage const &_work=WorkPackage())
virtual void kickOff()=0
Begin working on a given work package, discarding any previous work.
#define DEV_TIMED_ABOVE(S, MS)
std::pair< FarmFace *, unsigned > ConstructionInfo
WorkPackage const & work() const
std::lock_guard< std::mutex > Guard
virtual void pause()=0
No work left to be done. Pause until told to kickOff().
Class for hosting one or more Miners.
uint64_t ms
Total number of milliseconds of mining thus far.
virtual bool submitProof(Solution const &_p, Miner *_finder)=0
Called from a Miner to note a WorkPackage has a solution.
typename PoW::Solution Solution
GenericMiner< PoW > Miner
uint64_t hashes
Total number of hashes computed.
typename PoW::Solution Solution
Describes the progress of a mining operation.
uint64_t hashCount() const
A miner - a member and adoptee of the Farm.
typename PoW::WorkPackage WorkPackage