Browse Source

Trigger metrics UI refresh on new messages

pull/4/head
Jack Grigg 8 years ago
parent
commit
83561c9cb3
No known key found for this signature in database GPG Key ID: 6A6914DAFBEA00DA
  1. 15
      src/metrics.cpp
  2. 2
      src/metrics.h

15
src/metrics.cpp

@ -20,6 +20,7 @@
CCriticalSection cs_metrics;
boost::synchronized_value<int64_t> nNodeStartTime;
boost::synchronized_value<int64_t> nNextRefresh;
AtomicCounter transactionsValidated;
AtomicCounter ehSolverRuns;
AtomicCounter solutionTargetChecks;
@ -60,6 +61,13 @@ double GetLocalSolPS()
return GetLocalSolPS_INTERNAL(GetUptime());
}
void TriggerRefresh()
{
*nNextRefresh = GetTime();
// Ensure that the refresh has started before we return
MilliSleep(200);
}
static bool metrics_ThreadSafeMessageBox(const std::string& message,
const std::string& caption,
unsigned int style)
@ -85,6 +93,9 @@ static bool metrics_ThreadSafeMessageBox(const std::string& message,
if (u->size() > 5) {
u->pop_back();
}
TriggerRefresh();
return false;
}
static void metrics_InitMessage(const std::string& message)
@ -333,8 +344,8 @@ void ThreadShowMetricsScreen()
std::cout << "----------------------------------------" << std::endl;
}
int64_t nWaitEnd = GetTime() + nRefresh;
while (GetTime() < nWaitEnd) {
*nNextRefresh = GetTime() + nRefresh;
while (GetTime() < *nNextRefresh) {
boost::this_thread::interruption_point();
MilliSleep(200);
}

2
src/metrics.h

@ -34,6 +34,8 @@ void TrackMinedBlock(uint256 hash);
void MarkStartTime();
double GetLocalSolPS();
void TriggerRefresh();
void ConnectMetricsScreen();
void ThreadShowMetricsScreen();

Loading…
Cancel
Save