1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

add a little more to the debugging output

This commit is contained in:
Joel Bender 2017-09-19 02:57:37 -04:00
parent 6f577ea2d6
commit 9a54d2f365

View File

@ -42,29 +42,29 @@ class TimeMachine(_TaskManager):
time_machine = self time_machine = self
def get_time(self): def get_time(self):
if _debug: TimeMachine._debug("get_time") if _debug: TimeMachine._debug("get_time @ %r:", self.current_time)
# return the fake time # return the fake time
return self.current_time return self.current_time
def install_task(self, task): def install_task(self, task):
if _debug: TimeMachine._debug("install_task %r @ %r", task, task.taskTime) if _debug: TimeMachine._debug("install_task @ %r: %r @ %r", self.current_time, task, task.taskTime)
_TaskManager.install_task(self, task) _TaskManager.install_task(self, task)
def suspend_task(self, task): def suspend_task(self, task):
if _debug: TimeMachine._debug("suspend_task %r", task) if _debug: TimeMachine._debug("suspend_task @ %r: %r", self.current_time, task)
_TaskManager.suspend_task(self, task) _TaskManager.suspend_task(self, task)
def resume_task(self, task): def resume_task(self, task):
if _debug: TimeMachine._debug("resume_task %r", task) if _debug: TimeMachine._debug("resume_task @ %r: %r", self.current_time, task)
_TaskManager.resume_task(self, task) _TaskManager.resume_task(self, task)
def more_to_do(self): def more_to_do(self):
"""Get the next task if there's one that should be processed.""" """Get the next task if there's one that should be processed."""
if _debug: TimeMachine._debug("more_to_do @ %r", self.current_time) if _debug: TimeMachine._debug("more_to_do @ %r:", self.current_time)
# check if there are deferred functions # check if there are deferred functions
if _core.deferredFns: if _core.deferredFns:
@ -96,7 +96,7 @@ class TimeMachine(_TaskManager):
"""get the next task if there's one that should be processed, """get the next task if there's one that should be processed,
and return how long it will be until the next one should be and return how long it will be until the next one should be
processed.""" processed."""
if _debug: TimeMachine._debug("get_next_task @ %r", self.current_time) if _debug: TimeMachine._debug("get_next_task @ %r:", self.current_time)
if _debug: TimeMachine._debug(" - time_limit: %r", self.time_limit) if _debug: TimeMachine._debug(" - time_limit: %r", self.time_limit)
if _debug: TimeMachine._debug(" - tasks: %r", self.tasks) if _debug: TimeMachine._debug(" - tasks: %r", self.tasks)
@ -136,7 +136,7 @@ class TimeMachine(_TaskManager):
return (task, delta) return (task, delta)
def process_task(self, task): def process_task(self, task):
if _debug: TimeMachine._debug("process_task %r", task) if _debug: TimeMachine._debug("process_task @ %r: %r", self.current_time, task)
_TaskManager.process_task(self, task) _TaskManager.process_task(self, task)
@ -180,6 +180,10 @@ def run_time_machine(time_limit):
# pass the limit to the time machine # pass the limit to the time machine
time_machine.time_limit = time_machine.current_time + time_limit time_machine.time_limit = time_machine.current_time + time_limit
# check if there are deferred functions
if _core.deferredFns:
if _debug: run_time_machine._debug(" - deferred functions!")
# run until there is nothing left to do # run until there is nothing left to do
while True: while True:
_core.run_once() _core.run_once()