aboutsummaryrefslogtreecommitdiff
path: root/operationscore/PixelMapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'operationscore/PixelMapper.py')
-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)