Download cpp/tools/OmpHelper.h from USTC3DVer/Lite3DReg: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/USTC3DVer/Lite3DReg/resolve/main/cpp/tools/OmpHelper.h
- Command line
-
hf download hf://spaces/USTC3DVer/Lite3DReg/cpp/tools/OmpHelper.h
-
curl -L -o OmpHelper.h https://huggingface.co/spaces/USTC3DVer/Lite3DReg/resolve/main/cpp/tools/OmpHelper.h
1.51 kB
| class Timer | |
| { | |
| public: | |
| typedef int EventID; | |
| EventID get_time() | |
| { | |
| EventID id = time_values_.size(); | |
| time_values_.push_back(omp_get_wtime()); | |
| time_values_.push_back(clock()); | |
| return id; | |
| } | |
| double elapsed_time(EventID event1, EventID event2) | |
| { | |
| assert(event1 >= 0 && event1 < static_cast<EventID>(time_values_.size())); | |
| assert(event2 >= 0 && event2 < static_cast<EventID>(time_values_.size())); | |
| return time_values_[event2] - time_values_[event1]; | |
| return double(time_values_[event2] - time_values_[event1]) / CLOCKS_PER_SEC; | |
| } | |
| void reset() | |
| { | |
| time_values_.clear(); | |
| } | |
| private: | |
| std::vector<double> time_values_; | |
| std::vector<clock_t> time_values_; | |
| }; | |