diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-30 17:35:21 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-30 17:35:21 +0300 |
commit | f5c978074cf2398531c4d10661235f6083bb47a5 (patch) | |
tree | 3902080f4d5ad78ad82400eaee0180417aadf0f2 /intern/cycles/util/util_time.h | |
parent | 4d2eb42cfd71a04fbe70f36ab7a676f39d7c4957 (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.h | 20 |
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 |