Browse Source

logging for jchow.

testing for ethashcl.
cl-refactor
Gav Wood 10 years ago
parent
commit
b5761c33b6
  1. 12
      exp/main.cpp
  2. 2
      libdevcore/Common.cpp
  3. 3
      libethcore/ProofOfWork.cpp
  4. 2
      libethereum/BlockChain.cpp
  5. 18
      libethereum/Client.cpp

12
exp/main.cpp

@ -108,20 +108,14 @@ int main()
#else #else
int main() int main()
{ {
std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
if (platforms.empty())
{
cdebug << "No OpenCL platforms found.";
return false;
}
EthashCL ecl; EthashCL ecl;
BlockInfo genesis = CanonBlockChain::genesis(); BlockInfo genesis = CanonBlockChain::genesis();
TransientDirectory td; genesis.difficulty = 1 << 18;
cdebug << (h256)u256((bigint(1) << 256) / genesis.difficulty);
std::pair<MineInfo, Ethash::Proof> r; std::pair<MineInfo, Ethash::Proof> r;
while (!r.first.completed) while (!r.first.completed)
r = ecl.mine(genesis, 1000); r = ecl.mine(genesis, 1000);
cdebug << r.second.mixHash << r.second.nonce;
EthashCL::assignResult(r.second, genesis); EthashCL::assignResult(r.second, genesis);
assert(EthashCPU::verify(genesis)); assert(EthashCPU::verify(genesis));
return 0; return 0;

2
libdevcore/Common.cpp

@ -27,7 +27,7 @@ using namespace dev;
namespace dev namespace dev
{ {
char const* Version = "0.9.6"; char const* Version = "0.9.7";
} }

3
libethcore/ProofOfWork.cpp

@ -128,6 +128,7 @@ struct EthashCLHook: public ethash_cl_miner::search_hook
{ {
void abort() void abort()
{ {
cdebug << "Attempting to abort";
if (m_aborted) if (m_aborted)
return; return;
m_abort = true; m_abort = true;
@ -149,12 +150,14 @@ protected:
for (unsigned i = 0; i < _count; ++i) for (unsigned i = 0; i < _count; ++i)
m_found.push_back((Nonce)(u64)_nonces[i]); m_found.push_back((Nonce)(u64)_nonces[i]);
m_aborted = true; m_aborted = true;
cdebug << "Found nonces: " << vector<uint64_t>(_nonces, _nonces + _count);
return true; return true;
} }
virtual bool searched(uint64_t _startNonce, uint32_t _count) override virtual bool searched(uint64_t _startNonce, uint32_t _count) override
{ {
Guard l(x_all); Guard l(x_all);
cdebug << "Searched" << _count << "from" << _startNonce;
m_total += _count; m_total += _count;
m_last = _startNonce + _count; m_last = _startNonce + _count;
if (m_abort) if (m_abort)

2
libethereum/BlockChain.cpp

@ -601,7 +601,7 @@ pair<h256s, h256> BlockChain::import(bytes const& _block, OverlayDB const& _db,
m_extrasDB->Put(m_writeOptions, toSlice(h, ExtraTransactionAddress), (ldb::Slice)dev::ref(m_transactionAddresses[h].rlp())); m_extrasDB->Put(m_writeOptions, toSlice(h, ExtraTransactionAddress), (ldb::Slice)dev::ref(m_transactionAddresses[h].rlp()));
} }
clog(BlockChainNote) << " Imported and best" << td << ". Has" << (details(bi.parentHash).children.size() - 1) << "siblings. Route:" << toString(route); clog(BlockChainNote) << " Imported and best" << td << " (#" << bi.number << "). Has" << (details(bi.parentHash).children.size() - 1) << "siblings. Route:" << toString(route);
noteCanonChanged(); noteCanonChanged();
StructuredLogger::chainNewHead( StructuredLogger::chainNewHead(

18
libethereum/Client.cpp

@ -259,16 +259,28 @@ void Client::clearPending()
noteChanged(changeds); noteChanged(changeds);
} }
template <class T>
static string filtersToString(T const& _fs)
{
stringstream ret;
ret << "{";
bool i = false;
for (h256 const& f: _fs)
ret << (i++ ? ", " : "") << (f == PendingChangedFilter ? "pending" : f == ChainChangedFilter ? "chain" : f.abridged());
ret << "}";
return ret.str();
}
void Client::noteChanged(h256Set const& _filters) void Client::noteChanged(h256Set const& _filters)
{ {
Guard l(x_filtersWatches); Guard l(x_filtersWatches);
if (_filters.size()) if (_filters.size())
cnote << "noteChanged(" << _filters << ")"; cnote << "noteChanged(" << filtersToString(_filters) << ")";
// accrue all changes left in each filter into the watches. // accrue all changes left in each filter into the watches.
for (auto& w: m_watches) for (auto& w: m_watches)
if (_filters.count(w.second.id)) if (_filters.count(w.second.id))
{ {
cwatch << "!!!" << w.first << w.second.id; cwatch << "!!!" << w.first << (m_filters.count(w.second.id) ? w.second.id.abridged() : w.second.id == PendingChangedFilter ? "pending" : w.second.id == ChainChangedFilter ? "chain" : "???");
if (m_filters.count(w.second.id)) // Normal filtering watch if (m_filters.count(w.second.id)) // Normal filtering watch
w.second.changes += m_filters.at(w.second.id).changes; w.second.changes += m_filters.at(w.second.id).changes;
else // Special ('pending'/'latest') watch else // Special ('pending'/'latest') watch
@ -523,7 +535,7 @@ void Client::doWork()
clog(ClientChat) << "Live block:" << h.abridged(); clog(ClientChat) << "Live block:" << h.abridged();
for (auto const& th: m_bc.transactionHashes(h)) for (auto const& th: m_bc.transactionHashes(h))
{ {
clog(ClientNote) << "Safely dropping transaction " << th; clog(ClientNote) << "Safely dropping transaction " << th.abridged();
m_tq.drop(th); m_tq.drop(th);
} }
} }

Loading…
Cancel
Save