Fabcoin Core  0.16.2
P2P Digital Currency
EthashCPUMiner.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
24 #pragma once
25 
26 #include "libdevcore/Worker.h"
28 #include "EthashAux.h"
29 
30 namespace dev
31 {
32 namespace eth
33 {
34 
35 class EthashCPUMiner: public GenericMiner<EthashProofOfWork>, Worker
36 {
37 public:
40 
41  static unsigned instances() { return s_numInstances > 0 ? s_numInstances : std::thread::hardware_concurrency(); }
42  static std::string platformInfo();
43  static void listDevices() {}
44  static bool configureGPU(unsigned, unsigned, unsigned, unsigned, unsigned, bool, unsigned, uint64_t) { return false; }
45  static void setNumInstances(unsigned _instances) { s_numInstances = std::min<unsigned>(_instances, std::thread::hardware_concurrency()); }
46 
47 protected:
48  void kickOff() override;
49  void pause() override;
50 
51 private:
52  void workLoop() override;
53  static unsigned s_numInstances;
54 };
55 
56 }
57 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
void pause() override
No work left to be done.
static unsigned instances()
EthashCPUMiner(GenericMiner< EthashProofOfWork >::ConstructionInfo const &_ci)
void workLoop() override
Overrides doWork(); should call shouldStop() often and exit when true.
static unsigned s_numInstances
static void setNumInstances(unsigned _instances)
void kickOff() override
Begin working on a given work package, discarding any previous work.
A miner - a member and adoptee of the Farm.
Definition: GenericMiner.h:43
static std::string platformInfo()
static bool configureGPU(unsigned, unsigned, unsigned, unsigned, unsigned, bool, unsigned, uint64_t)