Fix JobQueue to measure waiting and run times correctly

This commit is contained in:
Vinnie Falco
2013-10-01 12:22:38 -07:00
parent 2ac2fdfabd
commit 46d3ace6b7
5 changed files with 6 additions and 15 deletions

View File

@@ -86,6 +86,7 @@ bool Job::shouldCancel () const
void Job::doJob ()
{
m_loadEvent->start ();
m_loadEvent->reName (mName);
mJob (*this);
@@ -96,11 +97,6 @@ void Job::rename (std::string const& newName)
mName = newName;
}
LoadEvent& Job::peekEvent() const
{
return *m_loadEvent;
}
const char* Job::toString (JobType t)
{
switch (t)

View File

@@ -107,8 +107,6 @@ public:
void rename (const std::string& n);
LoadEvent& peekEvent() const;
// These comparison operators make the jobs sort in priority order in the job set
bool operator< (const Job& j) const;
bool operator> (const Job& j) const;

View File

@@ -141,9 +141,6 @@ public:
m_jobSet.insert (Job (
type, name, ++m_lastJob, m_loads[type], jobFunc, m_cancelCallback));
// start timing how long it stays in the queue
it.first->peekEvent().start();
queueJob (*it.first, lock);
}
}

View File

@@ -21,7 +21,7 @@ LoadEvent::LoadEvent (LoadMonitor& monitor, const std::string& name, bool should
: m_loadMonitor (monitor)
, m_isRunning (false)
, m_name (name)
, m_timeStopped (Time::getCurrentTime())
, m_timeStopped (RelativeTime::fromStartup())
, m_secondsWaiting (0)
, m_secondsRunning (0)
{
@@ -62,7 +62,7 @@ void LoadEvent::reName (const std::string& name)
void LoadEvent::start ()
{
Time currentTime (Time::getCurrentTime());
RelativeTime const currentTime (RelativeTime::fromStartup());
// If we already called start, this call will replace the previous one.
if (m_isRunning)
@@ -82,7 +82,7 @@ void LoadEvent::stop ()
{
bassert (m_isRunning);
m_timeStopped = Time::getCurrentTime();
m_timeStopped = RelativeTime::fromStartup();
m_secondsRunning += (m_timeStopped - m_timeStarted).inSeconds();
m_isRunning = false;

View File

@@ -71,8 +71,8 @@ private:
LoadMonitor& m_loadMonitor;
bool m_isRunning;
std::string m_name;
Time m_timeStopped;
Time m_timeStarted;
RelativeTime m_timeStopped;
RelativeTime m_timeStarted;
double m_secondsWaiting;
double m_secondsRunning;
};