Created
March 24, 2015 09:27
-
-
Save dvinella/31d94f9dd0e47586658d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from twisted.internet import reactor | |
from twisted.internet.task import LoopingCall | |
from twisted.python import log | |
from twisted.python.logfile import LogFile | |
log.startLogging(LogFile('lc.log', '.')) | |
def count_callable(calls): | |
log.msg(format='***************** %(t)f calls:%(c)d', | |
t=time.time(), c=calls) | |
if calls != 1: | |
log.msg('******************************************* anomaly') | |
def debug_lc(lc): | |
log.msg(format="_expectNextCallAt %(x)f", x=lc._expectNextCallAt) | |
log.msg(format=" _realLastTime %(x)f", x=lc._realLastTime) | |
lc = LoopingCall.withCount(count_callable) | |
lc.start(0.02) | |
lc_debug = LoopingCall(debug_lc, lc) | |
lc_debug.start(0.02) | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment