From 954bdc49fae0ca1505953e64046732693a29481b Mon Sep 17 00:00:00 2001 From: SergiySW Date: Tue, 31 Oct 2017 16:57:03 +0300 Subject: [PATCH] Adding single-thread blake2b debug generation --- rai/rai_node/entry.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rai/rai_node/entry.cpp b/rai/rai_node/entry.cpp index 34c82089..3f0fa189 100644 --- a/rai/rai_node/entry.cpp +++ b/rai/rai_node/entry.cpp @@ -123,6 +123,7 @@ int main (int argc, char * const * argv) ("debug_profile_kdf", "Profile kdf function") ("debug_verify_profile", "Profile signature verification") ("debug_xorshift_profile", "Profile xorshift algorithms") + ("debug_blake2b_generate", "Blake2b work generation") ("platform", boost::program_options::value (), "Defines the for OpenCL commands") ("device", boost::program_options::value (), "Defines for OpenCL command") ("threads", boost::program_options::value (), "Defines count for OpenCL command"); @@ -268,6 +269,23 @@ int main (int argc, char * const * argv) std::cerr << boost::str (boost::format ("%|1$ 12d|\n") % std::chrono::duration_cast (end1 - begin1).count ()); } } + else if (vm.count ("debug_blake2b_generate")) + { + rai::work_pool work (std::numeric_limits ::max (), nullptr); + rai::change_block block (0, 0, rai::keypair ().prv, 0, 0); + for (uint64_t i (0); true; ++i) + { + block.hashables.previous.qwords [0] += 1; + auto begin1 (std::chrono::high_resolution_clock::now ()); + auto hash (block.hash ()); + for (uint64_t t (0); t < 1000000; ++t) + { + work.work_value (hash, t); + } + auto end1 (std::chrono::high_resolution_clock::now ()); + std::cerr << boost::str (boost::format ("%|1$ 12d|\n") % std::chrono::duration_cast (end1 - begin1).count ()); + } + } else if (vm.count ("debug_opencl")) { bool error (false);