// Copyright (c) 2016 The Zcash developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "uint256.h" #include #include #include struct AtomicCounter { std::atomic value; AtomicCounter() : value {0} { } void increment(){ ++value; } void decrement(){ --value; } int get() const { return value.load(); } }; class AtomicTimer { private: std::mutex mtx; uint64_t threads; int64_t start_time; int64_t total_time; public: AtomicTimer() : threads(0), start_time(0), total_time(0) {} /** * Starts timing on first call, and counts the number of calls. */ void start(); /** * Counts number of calls, and stops timing after it has been called as * many times as start(). */ void stop(); bool running(); uint64_t threadCount(); double rate(const AtomicCounter& count); }; extern AtomicCounter transactionsValidated; extern AtomicCounter ehSolverRuns; extern AtomicCounter solutionTargetChecks; extern AtomicTimer miningTimer; void TrackMinedBlock(uint256 hash); void MarkStartTime(); double GetLocalSolPS(); int EstimateNetHeightInner(int height, int64_t tipmediantime, int heightLastCheckpoint, int64_t timeLastCheckpoint, int64_t genesisTime, int64_t targetSpacing); void TriggerRefresh(); void ConnectMetricsScreen(); void ThreadShowMetricsScreen(); /** * Heart image: https://commons.wikimedia.org/wiki/File:Heart_coraz%C3%B3n.svg * License: CC BY-SA 3.0 * * Rendering options: * Zcash: img2txt -W 40 -H 20 -f utf8 -d none -g 0.7 Z-yellow.orange-logo.png * Heart: img2txt -W 40 -H 20 -f utf8 -d none 2000px-Heart_corazón.svg.png */ const std::string METRICS_ART = "   \n" "   \n" "  :88SX@888@@X8:  8; %X X% ;8 \n" "  %%Xt%tt%SSSSS:XXXt@@  X :: :: X \n" "  @S;;tt%%%t ;;::XXXXSX  % SS % \n" "  .t:::;;%8888 88888tXXXX8;  S S \n" "  .%...:::8 8::XXX%;  X X \n" "  8888...:t888888X 8t;;::XX8   8 8 \n" " %888888...:::;:8  :Xttt;;;::X@    \n" " 888888888...:St 8:%%tttt;;;:X  X X \n" " 88888888888S8  :%;ttt%%tttt;;X  8 8 \n" " %888888888%t 8S:;;;tt%%%ttt;8  : : \n" "  8t8888888  S8888888Stt%%%t@   :: :: \n" "  .@tt888@ 8;;ttt@;  t t \n" "  .8ttt8@SSSSS SXXXX%:;;;X;  8 8 \n" "  X8ttt8888% %88...::X8   X. .X \n" "  %8@tt88;8888%8888%8X   :; ;: \n" "  :@888@XXX@888:  tt \n" "   \n" "   ";