Add -metricsrefreshtime option
This commit is contained in:
@@ -249,7 +249,9 @@ void ThreadShowMetricsScreen()
|
|||||||
RenameThread("zcash-metrics-screen");
|
RenameThread("zcash-metrics-screen");
|
||||||
|
|
||||||
// Determine whether we should render a persistent UI or rolling metrics
|
// Determine whether we should render a persistent UI or rolling metrics
|
||||||
bool isScreen = GetBoolArg("-metricsui", isatty(STDOUT_FILENO));
|
bool isTTY = isatty(STDOUT_FILENO);
|
||||||
|
bool isScreen = GetBoolArg("-metricsui", isTTY);
|
||||||
|
int64_t nRefresh = GetArg("-metricsrefreshtime", isTTY ? 1 : 600);
|
||||||
|
|
||||||
if (isScreen) {
|
if (isScreen) {
|
||||||
// Clear screen
|
// Clear screen
|
||||||
@@ -274,7 +276,7 @@ void ThreadShowMetricsScreen()
|
|||||||
int cols = 80;
|
int cols = 80;
|
||||||
|
|
||||||
// Get current window size
|
// Get current window size
|
||||||
if (isatty(STDOUT_FILENO)) {
|
if (isTTY) {
|
||||||
struct winsize w;
|
struct winsize w;
|
||||||
w.ws_col = 0;
|
w.ws_col = 0;
|
||||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||||
@@ -306,8 +308,11 @@ void ThreadShowMetricsScreen()
|
|||||||
std::cout << "----------------" << std::endl;
|
std::cout << "----------------" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::this_thread::interruption_point();
|
int64_t nWaitEnd = GetTime() + nRefresh;
|
||||||
MilliSleep(1000);
|
while (GetTime() < nWaitEnd) {
|
||||||
|
boost::this_thread::interruption_point();
|
||||||
|
MilliSleep(200);
|
||||||
|
}
|
||||||
|
|
||||||
if (isScreen) {
|
if (isScreen) {
|
||||||
// Return to the top of the updating section
|
// Return to the top of the updating section
|
||||||
|
|||||||
Reference in New Issue
Block a user