Improve the display resolution of LoadMonitor samples

This commit is contained in:
Vinnie Falco
2013-09-30 04:04:43 -07:00
parent 217a017195
commit d27ad6251c
4 changed files with 19 additions and 10 deletions

View File

@@ -40,17 +40,17 @@ std::string const& LoadEvent::name () const
return m_name;
}
std::size_t LoadEvent::getSecondsWaiting() const
double LoadEvent::getSecondsWaiting() const
{
return m_secondsWaiting;
}
std::size_t LoadEvent::getSecondsRunning() const
double LoadEvent::getSecondsRunning() const
{
return m_secondsRunning;
}
std::size_t LoadEvent::getSecondsTotal() const
double LoadEvent::getSecondsTotal() const
{
return m_secondsWaiting + m_secondsRunning;
}

View File

@@ -49,9 +49,9 @@ public:
~LoadEvent ();
std::string const& name () const;
std::size_t getSecondsWaiting() const;
std::size_t getSecondsRunning() const;
std::size_t getSecondsTotal() const;
double getSecondsWaiting() const;
double getSecondsRunning() const;
double getSecondsTotal() const;
// VFALCO TODO rename this to setName () or setLabel ()
void reName (const std::string& name);
@@ -73,8 +73,8 @@ private:
std::string m_name;
Time m_timeStopped;
Time m_timeStarted;
std::size_t m_secondsWaiting;
std::size_t m_secondsRunning;
double m_secondsWaiting;
double m_secondsRunning;
};
#endif

View File

@@ -108,6 +108,13 @@ void LoadMonitor::addLatency (int latency)
mLatencyMSPeak = latencyPeak;
}
std::string LoadMonitor::printElapsed (double seconds)
{
std::stringstream ss;
ss << (std::size_t (seconds * 1000 + 0.5)) << " ms";
return ss.str();
}
void LoadMonitor::addLoadSample (LoadEvent const& sample)
{
std::string const& name (sample.name());
@@ -116,8 +123,8 @@ void LoadMonitor::addLoadSample (LoadEvent const& sample)
if (latency.inSeconds() > 0.5)
{
WriteLog ((latency.inSeconds() > 1.0) ? lsWARNING : lsINFO, LoadMonitor)
<< "Job: " << name << " ExecutionTime: " << RelativeTime (sample.getSecondsRunning()) <<
" WaitingTime: " << RelativeTime (sample.getSecondsWaiting());
<< "Job: " << name << " ExecutionTime: " << printElapsed (sample.getSecondsRunning()) <<
" WaitingTime: " << printElapsed (sample.getSecondsWaiting());
}
// VFALCO NOTE Why does 1 become 0?

View File

@@ -46,6 +46,8 @@ public:
bool isOver ();
private:
static std::string printElapsed (double seconds);
void update ();
typedef RippleMutex LockType;