Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_time.h
| Show All 23 Lines | |||||
| double time_dt(); | double time_dt(); | ||||
| /* Sleep for the specified number of seconds */ | /* Sleep for the specified number of seconds */ | ||||
| void time_sleep(double t); | void time_sleep(double t); | ||||
| class scoped_timer { | class scoped_timer { | ||||
| public: | public: | ||||
| explicit scoped_timer(double *value) : value_(value) | explicit scoped_timer(double *value = NULL) : value_(value) | ||||
| { | { | ||||
| time_start_ = time_dt(); | time_start_ = time_dt(); | ||||
| } | } | ||||
| ~scoped_timer() | ~scoped_timer() | ||||
| { | { | ||||
| if(value_ != NULL) { | if(value_ != NULL) { | ||||
| *value_ = time_dt() - time_start_; | *value_ = time_dt() - time_start_; | ||||
| } | } | ||||
| } | } | ||||
| double get_start() const | |||||
| { | |||||
| return time_start_; | |||||
| } | |||||
| protected: | protected: | ||||
| double *value_; | double *value_; | ||||
| double time_start_; | double time_start_; | ||||
| }; | }; | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
| #endif | #endif | ||||