Mercurial > code > home > repos > light9
changeset 1426:05a5226a8d61
logging and tweaks to collector
Ignore-this: d2083701fb026e834e6bd947d371584f
author | drewp@bigasterisk.com |
---|---|
date | Sat, 11 Jun 2016 04:31:11 +0000 |
parents | 8796803a1b45 |
children | e070c9f1c5e7 |
files | bin/collector light9/collector/collector.py light9/collector/device.py light9/collector/output.py |
diffstat | 4 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/collector Sat Jun 11 04:30:40 2016 +0000 +++ b/bin/collector Sat Jun 11 04:31:11 2016 +0000 @@ -61,8 +61,10 @@ def launch(graph): # todo: drive outputs with config files - outputs = [EnttecDmx(L9['output/dmx0/'], '/dev/dmx0'), - Udmx(L9['output/udmx/'])] + outputs = [ + EnttecDmx(L9['output/dmx0/'], '/dev/dmx0'), + Udmx(L9['output/udmx/']), + ] c = Collector(graph, outputs) server = WebServer(c)
--- a/light9/collector/collector.py Sat Jun 11 04:30:40 2016 +0000 +++ b/light9/collector/collector.py Sat Jun 11 04:31:11 2016 +0000 @@ -109,7 +109,9 @@ for outputAttr, value in attrs.iteritems(): self.setAttr(device, outputAttr, value, pendingOut) + print "%.1fms for client math" % (1000 * (time.time() - now)) self.flush(pendingOut) + print "%.1fms including flush" % (1000 * (time.time() - now)) def setAttr(self, device, outputAttr, value, pendingOut): output, index = self.outputMap[(device, outputAttr)]
--- a/light9/collector/device.py Sat Jun 11 04:30:40 2016 +0000 +++ b/light9/collector/device.py Sat Jun 11 04:31:11 2016 +0000 @@ -9,6 +9,7 @@ log = logging.getLogger('device') + class Device(object): def setAttrs(): pass
--- a/light9/collector/output.py Sat Jun 11 04:30:40 2016 +0000 +++ b/light9/collector/output.py Sat Jun 11 04:31:11 2016 +0000 @@ -68,7 +68,7 @@ self.dev = Dmx(devicePath) self.currentBuffer = '' self.lastLog = 0 - task.LoopingCall(self._loop).start(1 / 50) + task.LoopingCall(self._loop).start(0.050) @stats.update.time() def update(self, values): @@ -105,7 +105,7 @@ # 2. Retries if there are usb errors. # Copying the LoopingCall logic accomplishes those with a # little wasted time if there are no updates. - task.LoopingCall(self._loop).start(1 / 50) + task.LoopingCall(self._loop).start(0.050) @stats.update.time() def update(self, values): @@ -117,14 +117,13 @@ self.currentBuffer = ''.join(map(chr, values)) def _loop(self): - if self.lastSentBuffer == self.currentBuffer: - return + #if self.lastSentBuffer == self.currentBuffer: + # return with Udmx.stats.write.time(): # frequently errors with usb.core.USBError try: self.dev.SendDMX(self.currentBuffer) self.lastSentBuffer = self.currentBuffer - return except usb.core.USBError: Udmx.stats.usbErrors += 1