added some debug messages

This commit is contained in:
fgerlits 2006-11-30 15:31:34 +00:00
parent db22b940e5
commit 15bc76462b
1 changed files with 14 additions and 0 deletions

View File

@ -33,6 +33,9 @@
#include "configure.h" #include "configure.h"
#endif #endif
#define DEBUG_PREFIX "SchedulerThread"
#include "LiveSupport/Core/Debug.h"
#include "LiveSupport/Core/TimeConversion.h" #include "LiveSupport/Core/TimeConversion.h"
#include "SchedulerThread.h" #include "SchedulerThread.h"
@ -60,6 +63,8 @@ SchedulerThread :: SchedulerThread(
Ptr<time_duration>::Ref granularity) Ptr<time_duration>::Ref granularity)
throw () throw ()
{ {
DEBUG_FUNC_INFO
this->eventContainer = eventContainer; this->eventContainer = eventContainer;
this->granularity = granularity; this->granularity = granularity;
this->shouldRun = false; this->shouldRun = false;
@ -72,6 +77,8 @@ SchedulerThread :: SchedulerThread(
void void
SchedulerThread :: getNextEvent(Ptr<ptime>::Ref when) throw () SchedulerThread :: getNextEvent(Ptr<ptime>::Ref when) throw ()
{ {
DEBUG_FUNC_INFO
nextEvent = eventContainer->getNextEvent(when); nextEvent = eventContainer->getNextEvent(when);
if (nextEvent.get()) { if (nextEvent.get()) {
nextEventTime = nextEvent->getScheduledTime(); nextEventTime = nextEvent->getScheduledTime();
@ -95,6 +102,7 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
} }
if (imminent(now, nextInitTime)) { if (imminent(now, nextInitTime)) {
debug() << "next event init coming" << std::endl;
try { try {
nextEvent->initialize(); nextEvent->initialize();
} catch (std::exception &e) { } catch (std::exception &e) {
@ -106,11 +114,13 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
<< std::endl; << std::endl;
} }
} else if (imminent(now, nextEventTime)) { } else if (imminent(now, nextEventTime)) {
debug() << "next event start coming" << std::endl;
Ptr<time_duration>::Ref timeLeft(new time_duration(*nextEventTime Ptr<time_duration>::Ref timeLeft(new time_duration(*nextEventTime
- *now)); - *now));
TimeConversion::sleep(timeLeft); TimeConversion::sleep(timeLeft);
nextEvent->start(); nextEvent->start();
} else if (imminent(now, nextEventEnd)) { } else if (imminent(now, nextEventEnd)) {
debug() << "next event end coming" << std::endl;
Ptr<time_duration>::Ref timeLeft(new time_duration(*nextEventEnd Ptr<time_duration>::Ref timeLeft(new time_duration(*nextEventEnd
- *now)); - *now));
TimeConversion::sleep(timeLeft); TimeConversion::sleep(timeLeft);
@ -126,6 +136,8 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
void void
SchedulerThread :: run(void) throw () SchedulerThread :: run(void) throw ()
{ {
DEBUG_FUNC_INFO
shouldRun = true; shouldRun = true;
getNextEvent(TimeConversion::now()); getNextEvent(TimeConversion::now());
@ -152,6 +164,8 @@ SchedulerThread :: run(void) throw ()
void void
SchedulerThread :: signal(int signalId) throw () SchedulerThread :: signal(int signalId) throw ()
{ {
DEBUG_FUNC_INFO
switch (signalId) { switch (signalId) {
case UpdateSignal: case UpdateSignal:
getNextEvent(TimeConversion::now()); getNextEvent(TimeConversion::now());