I've installed metrology and next sample script fails:
#!/usr/bin/env python
#coding: utf-8
import time
import logging
from metrology import Metrology
timer = Metrology.timer('do_it_timer')
if __name__ == '__main__':
with timer:
time.sleep(15)
print timer.mean
With an exception:
Traceback (most recent call last):
File "metrology-sample.py", line 16, in <module>
time.sleep(15)
File "/home/vagrant/src/metrology-sample/venv/local/lib/python2.7/site-packages/metrology/instruments/timer.py", line 40, in __exit__
self.update(duration)
File "/home/vagrant/src/metrology-sample/venv/local/lib/python2.7/site-packages/metrology/instruments/timer.py", line 27, in update
self.meter.mark()
File "/home/vagrant/src/metrology-sample/venv/local/lib/python2.7/site-packages/metrology/instruments/meter.py", line 13, in wrapper
self._tick()
File "/home/vagrant/src/metrology-sample/venv/local/lib/python2.7/site-packages/metrology/instruments/meter.py", line 42, in _tick
if ticks and self.last_tick.compare_and_swap(old_tick, new_tick):
File "/home/vagrant/src/metrology-sample/venv/local/lib/python2.7/site-packages/atomic/__init__.py", line 89, in compare_and_swap
return self.compare_and_set(expect_value, new_value)
File "/home/vagrant/src/metrology-sample/venv/local/lib/python2.7/site-packages/atomic/__init__.py", line 86, in compare_and_set
return bool(atomic.long_compare_and_set(self._value, ffi.new('long *', expect_value), new_value))
TypeError: an integer is required
Good day.
Sorry for my bad English.
I've installed metrology and next sample script fails:
With an exception:
Is it ok?
BTW https://github.com/cyberdelia/metrology/blob/master/tests/instruments/test_timer.py#L18 will fail too if you'll increase sleep time.