Major updates integration from all upstreams
This commit is contained in:
@@ -73,6 +73,14 @@ double AtomicTimer::rate(const AtomicCounter& count)
|
||||
return duration > 0 ? (double)count.get() / duration : 0;
|
||||
}
|
||||
|
||||
boost::synchronized_value<int64_t> nNodeStartTime;
|
||||
boost::synchronized_value<int64_t> nNextRefresh;
|
||||
int64_t nHashCount;
|
||||
AtomicCounter transactionsValidated;
|
||||
AtomicCounter ehSolverRuns;
|
||||
AtomicCounter solutionTargetChecks;
|
||||
static AtomicCounter minedBlocks;
|
||||
AtomicTimer miningTimer;
|
||||
CCriticalSection cs_metrics;
|
||||
|
||||
double AtomicTimer::rate(const int64_t count)
|
||||
@@ -87,20 +95,11 @@ double AtomicTimer::rate(const int64_t count)
|
||||
return duration > 0 ? (double)count / duration : 0;
|
||||
}
|
||||
|
||||
boost::synchronized_value<int64_t> nNodeStartTime;
|
||||
boost::synchronized_value<int64_t> nNextRefresh;
|
||||
int64_t nHashCount;
|
||||
AtomicCounter transactionsValidated;
|
||||
AtomicCounter ehSolverRuns;
|
||||
AtomicCounter solutionTargetChecks;
|
||||
AtomicCounter minedBlocks;
|
||||
AtomicTimer miningTimer;
|
||||
static boost::synchronized_value<std::list<uint256>> trackedBlocks;
|
||||
|
||||
boost::synchronized_value<std::list<uint256>> trackedBlocks;
|
||||
|
||||
boost::synchronized_value<std::list<std::string>> messageBox;
|
||||
boost::synchronized_value<std::string> initMessage;
|
||||
bool loaded = false;
|
||||
static boost::synchronized_value<std::list<std::string>> messageBox;
|
||||
static boost::synchronized_value<std::string> initMessage;
|
||||
static bool loaded = false;
|
||||
|
||||
extern int64_t GetNetworkHashPS(int lookup, int height);
|
||||
|
||||
@@ -439,6 +438,30 @@ int printInitMessage()
|
||||
return 2;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||
|
||||
bool enableVTMode()
|
||||
{
|
||||
// Set output mode to handle virtual terminal sequences
|
||||
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (hOut == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwMode = 0;
|
||||
if (!GetConsoleMode(hOut, &dwMode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
if (!SetConsoleMode(hOut, dwMode)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ThreadShowMetricsScreen()
|
||||
{
|
||||
// Make this thread recognisable as the metrics screen thread
|
||||
@@ -450,6 +473,10 @@ void ThreadShowMetricsScreen()
|
||||
int64_t nRefresh = GetArg("-metricsrefreshtime", isTTY ? 1 : 600);
|
||||
|
||||
if (isScreen) {
|
||||
#ifdef WIN32
|
||||
enableVTMode();
|
||||
#endif
|
||||
|
||||
// Clear screen
|
||||
std::cout << "\e[2J";
|
||||
|
||||
@@ -474,15 +501,16 @@ void ThreadShowMetricsScreen()
|
||||
// Get current window size
|
||||
if (isTTY) {
|
||||
#ifdef _WIN32
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
||||
cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||
#else
|
||||
struct winsize w;
|
||||
w.ws_col = 0;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||
cols = w.ws_col;
|
||||
}
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) != 0) {
|
||||
cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||
}
|
||||
#else
|
||||
struct winsize w;
|
||||
w.ws_col = 0;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||
cols = w.ws_col;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -508,7 +536,13 @@ void ThreadShowMetricsScreen()
|
||||
|
||||
if (isScreen) {
|
||||
// Explain how to exit
|
||||
std::cout << "[" << _("Press Ctrl+C to exit") << "] [" << _("Set 'showmetrics=0' to hide") << "]" << std::endl;
|
||||
std::cout << "[";
|
||||
#ifdef WIN32
|
||||
std::cout << _("'zcash-cli.exe stop' to exit");
|
||||
#else
|
||||
std::cout << _("Press Ctrl+C to exit");
|
||||
#endif
|
||||
std::cout << "] [" << _("Set 'showmetrics=0' to hide") << "]" << std::endl;
|
||||
} else {
|
||||
// Print delineator
|
||||
std::cout << "----------------------------------------" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user