mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix JobQueue to measure waiting and run times correctly
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user