// Copyright (c) 2016 The Zcash developers // Copyright (c) 2016-2020 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** * Copyright © 2014-2019 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * * holder information and the developer policies on copyright and licensing. * * * * Unless otherwise agreed in a custom licensing agreement, no part of the * * SuperNET software, including this file may be copied, modified, propagated * * or distributed except according to the terms contained in the LICENSE file * * * * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ #include "uint256.h" #include #include #include extern int64_t nHashCount; struct AtomicCounter { std::atomic value; AtomicCounter() : value {0} { } void increment(){ ++value; } void decrement(){ --value; } uint64_t 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); double rate(const int64_t 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" "   ";