Auto merge of #1878 - str4d:1875-non-tty-metrics-usability, r=str4d

Improve non-TTY metrics usability

Closes #1875.
This commit is contained in:
zkbot
2016-12-07 23:19:47 +00:00
2 changed files with 43 additions and 19 deletions

View File

@@ -450,6 +450,11 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-min", _("Start minimized"));
strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)"));
} else if (mode == HMM_BITCOIND) {
strUsage += HelpMessageGroup(_("Metrics Options (only if -daemon and -printtoconsole are not set):"));
strUsage += HelpMessageOpt("-showmetrics", _("Show metrics on stdout (default: 1 if running in a console, 0 otherwise)"));
strUsage += HelpMessageOpt("-metricsui", _("Set to 1 for a persistent metrics screen, 0 for sequential metrics output (default: 1 if running in a console, 0 otherwise)"));
strUsage += HelpMessageOpt("-metricsrefreshtime", strprintf(_("Number of seconds between metrics refreshes (default: %u if running in a console, %u otherwise)"), 1, 600));
}
return strUsage;
@@ -980,7 +985,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
if ((chainparams.NetworkIDString() != "regtest") &&
GetBoolArg("-showmetrics", true) &&
GetBoolArg("-showmetrics", isatty(STDOUT_FILENO)) &&
!fPrintToConsole && !GetBoolArg("-daemon", false)) {
// Start the persistent metrics interface
ConnectMetricsScreen();