summaryrefslogtreecommitdiffstats
path: root/libdimension-python/dimension.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension-python/dimension.pyx')
-rw-r--r--libdimension-python/dimension.pyx43
1 files changed, 43 insertions, 0 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index 54b7e66..442394b 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -27,6 +27,42 @@ import os
def dieOnWarnings(alwaysDie):
dmnsn_die_on_warnings(alwaysDie)
+##########
+# Timers #
+##########
+
+cdef class Timer:
+ cdef dmnsn_timer *_timer
+
+ def __init__(self):
+ self._timer = dmnsn_new_timer()
+
+ def __dealloc__(self):
+ dmnsn_delete_timer(self._timer)
+
+ def complete(self):
+ dmnsn_complete_timer(self._timer)
+
+ property real:
+ def __get__(self):
+ return self._timer.real
+ property user:
+ def __get__(self):
+ return self._timer.user
+ property system:
+ def __get__(self):
+ return self._timer.system
+
+ def __str__(self):
+ return '%.2fs (user: %.2fs; system: %.2fs)' % \
+ (self._timer.real, self._timer.user, self._timer.system)
+
+cdef _rawTimer(dmnsn_timer *timer):
+ cdef Timer self = Timer.__new__(Timer)
+ self._timer = timer
+ DMNSN_INCREF(self._timer)
+ return self
+
############
# Geometry #
############
@@ -887,6 +923,13 @@ cdef class Scene:
def __set__(self, n):
self._scene.nthreads = n
+ property boundingTimer:
+ def __get__(self):
+ return _rawTimer(self._scene.bounding_timer)
+ property renderTimer:
+ def __get__(self):
+ return _rawTimer(self._scene.render_timer)
+
def raytrace(self):
# Ensure the default texture is complete
cdef Texture default = Texture(Black)