diff options
author | eugue <eug.sun@gmail.com> | 2011-01-24 14:41:38 -0500 |
---|---|---|
committer | eugue <eug.sun@gmail.com> | 2011-01-24 14:41:38 -0500 |
commit | 00e836cfa4e2652d724972585d661143142af002 (patch) | |
tree | f612ea43024f13dc8c16f192735676e9976630fc /operationscore/PixelMapper.py | |
parent | d39f871cf9fcce13c6db315052a4951f692719f9 (diff) |
merge with biginstall
Diffstat (limited to 'operationscore/PixelMapper.py')
-rw-r--r-- | operationscore/PixelMapper.py | 6 |
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) |