aboutsummaryrefslogtreecommitdiff
path: root/operationscore
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2011-01-21 00:57:14 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2011-01-21 00:57:14 -0500
commita223608dda0751551c6e8688c0c0e1c9a1d4e69c (patch)
treecd0620097745b7053abec7346f6bd7e65d99dafe /operationscore
parentf45b5e262c394cf00ef88f7fca1eab1b4de0fec9 (diff)
Added a new config file to run the upstairs lights. Modified PixelMapper to
track cache hits. Added 60-strip layouts and renderer configs.
Diffstat (limited to 'operationscore')
-rw-r--r--operationscore/PixelMapper.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/operationscore/PixelMapper.py b/operationscore/PixelMapper.py
index e3f2515..1f94fa5 100644
--- a/operationscore/PixelMapper.py
+++ b/operationscore/PixelMapper.py
@@ -3,8 +3,14 @@ import pdb
class PixelMapper(SmootCoreObject):
def init(self):
self.mem = {} #Dictionary of all seen events
+ self.totalCalls = 0
+ self.cachehits = 0
def mapEvent(self, eventLocation, screen):
+ self.totalCalls += 1
+ if self.totalCalls % 100 == 0:
+ print self['Id'], self.cachehits / float(self.totalCalls)
if eventLocation in self.mem:
+ self.cachehits += 1
return self.mem[eventLocation]
else:
self.mem[eventLocation] = self.mappingFunction(eventLocation, screen)