Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-12-30 17:35:21 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-12-30 17:35:21 +0300
commitf5c978074cf2398531c4d10661235f6083bb47a5 (patch)
tree3902080f4d5ad78ad82400eaee0180417aadf0f2 /intern/cycles/util/util_time.h
parent4d2eb42cfd71a04fbe70f36ab7a676f39d7c4957 (diff)
Cycles: Code cleanup: use scoped timer to measure parts of SVM compiler
Diffstat (limited to 'intern/cycles/util/util_time.h')
-rw-r--r--intern/cycles/util/util_time.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/intern/cycles/util/util_time.h b/intern/cycles/util/util_time.h
index 14ffea7f3da..e2f7ca2baa1 100644
--- a/intern/cycles/util/util_time.h
+++ b/intern/cycles/util/util_time.h
@@ -27,6 +27,26 @@ double time_dt();
void time_sleep(double t);
+class scoped_timer {
+public:
+ scoped_timer(double *value) : value_(value)
+ {
+ if(value_ != NULL) {
+ time_start_ = time_dt();
+ }
+ }
+
+ ~scoped_timer()
+ {
+ if(value_ != NULL) {
+ *value_ = time_dt() - time_start_;
+ }
+ }
+protected:
+ double *value_;
+ double time_start_;
+};
+
CCL_NAMESPACE_END
#endif