Better debug messages

This commit is contained in:
paul 2006-12-01 16:36:55 +00:00
parent aafdd144d2
commit 2a50ad1cc7
2 changed files with 15 additions and 11 deletions

View File

@ -63,7 +63,7 @@ SchedulerThread :: SchedulerThread(
Ptr<time_duration>::Ref granularity) Ptr<time_duration>::Ref granularity)
throw () throw ()
{ {
DEBUG_FUNC_INFO //DEBUG_FUNC_INFO
this->eventContainer = eventContainer; this->eventContainer = eventContainer;
this->granularity = granularity; this->granularity = granularity;
@ -77,7 +77,7 @@ SchedulerThread :: SchedulerThread(
void void
SchedulerThread :: getNextEvent(Ptr<ptime>::Ref when) throw () SchedulerThread :: getNextEvent(Ptr<ptime>::Ref when) throw ()
{ {
DEBUG_FUNC_INFO //DEBUG_FUNC_INFO
nextEvent = eventContainer->getNextEvent(when); nextEvent = eventContainer->getNextEvent(when);
if (nextEvent.get()) { if (nextEvent.get()) {
@ -87,6 +87,9 @@ SchedulerThread :: getNextEvent(Ptr<ptime>::Ref when) throw ()
- *nextEvent->maxTimeToInitialize())); - *nextEvent->maxTimeToInitialize()));
nextEventEnd.reset(new ptime(*nextEventTime nextEventEnd.reset(new ptime(*nextEventTime
+ *nextEvent->eventLength())); + *nextEvent->eventLength()));
debug() << "::getNextEvent() - nextInitTime: " << to_simple_string(*nextInitTime) << endl;
debug() << " - nextEventTime: " << to_simple_string(*nextEventTime) << endl;
debug() << " - nextEventEnd: " << to_simple_string(*nextEventEnd) << endl;
} }
} }
@ -99,7 +102,7 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
{ {
if (nextEvent) { if (nextEvent) {
if (imminent(now, nextInitTime)) { if (imminent(now, nextInitTime)) {
debug() << "event init coming" << endl; debug() << "::nextStep() - Init [" << *TimeConversion::now() << "]" << endl;
try { try {
nextEvent->initialize(); nextEvent->initialize();
} catch (std::exception &e) { } catch (std::exception &e) {
@ -111,10 +114,10 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
<< std::endl; << std::endl;
} }
} else if (imminent(now, nextEventTime)) { } else if (imminent(now, nextEventTime)) {
debug() << "event start coming" << 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);
debug() << "::nextStep() - Start [" << *TimeConversion::now() << "]" << endl;
nextEvent->start(); nextEvent->start();
currentEvent = nextEvent; currentEvent = nextEvent;
currentEventEnd = nextEventEnd; currentEventEnd = nextEventEnd;
@ -123,13 +126,13 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
} }
if (currentEvent && imminent(now, currentEventEnd)) { if (currentEvent && imminent(now, currentEventEnd)) {
debug() << "event end coming" << endl;
Ptr<time_duration>::Ref timeLeft(new time_duration(*currentEventEnd Ptr<time_duration>::Ref timeLeft(new time_duration(*currentEventEnd
- *now)); - *now));
TimeConversion::sleep(timeLeft); TimeConversion::sleep(timeLeft);
currentEvent->stop(); currentEvent->stop();
currentEvent->deInitialize(); currentEvent->deInitialize();
currentEvent.reset(); currentEvent.reset();
debug() << "::nextStep() - End [" << *TimeConversion::now() << "]" << endl;
} }
} }
@ -140,7 +143,7 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
void void
SchedulerThread :: run(void) throw () SchedulerThread :: run(void) throw ()
{ {
DEBUG_FUNC_INFO //DEBUG_FUNC_INFO
shouldRun = true; shouldRun = true;
getNextEvent(TimeConversion::now()); getNextEvent(TimeConversion::now());
@ -168,7 +171,8 @@ SchedulerThread :: run(void) throw ()
void void
SchedulerThread :: signal(int signalId) throw () SchedulerThread :: signal(int signalId) throw ()
{ {
DEBUG_FUNC_INFO //DEBUG_FUNC_INFO
debug() << "::signal() - [" << *TimeConversion::now() << "]" << endl;
switch (signalId) { switch (signalId) {
case UpdateSignal: case UpdateSignal:

View File

@ -95,7 +95,7 @@ PlaylistEvent :: PlaylistEvent(
void void
PlaylistEvent :: initialize(void) throw (std::exception) PlaylistEvent :: initialize(void) throw (std::exception)
{ {
DEBUG_BLOCK //DEBUG_BLOCK
if (state != created) { if (state != created) {
throw std::logic_error("PlaylistEvent in bad state"); throw std::logic_error("PlaylistEvent in bad state");
@ -124,7 +124,7 @@ PlaylistEvent :: initialize(void) throw (std::exception)
void void
PlaylistEvent :: deInitialize(void) throw () PlaylistEvent :: deInitialize(void) throw ()
{ {
DEBUG_BLOCK //DEBUG_BLOCK
if (state != stopped) { if (state != stopped) {
// TODO: handle error? // TODO: handle error?
@ -148,7 +148,7 @@ PlaylistEvent :: deInitialize(void) throw ()
void void
PlaylistEvent :: start(void) throw () PlaylistEvent :: start(void) throw ()
{ {
DEBUG_BLOCK //DEBUG_BLOCK
if (state != initialized) { if (state != initialized) {
// TODO: handle error? // TODO: handle error?
@ -177,7 +177,7 @@ PlaylistEvent :: start(void) throw ()
void void
PlaylistEvent :: stop(void) throw () PlaylistEvent :: stop(void) throw ()
{ {
DEBUG_BLOCK //DEBUG_BLOCK
if (state != running) { if (state != running) {
// TODO: handle error? // TODO: handle error?