17 #include "fastdeploy/utils/utils.h" 22 class FASTDEPLOY_DECL TimeCounter {
24 void Start() { begin_ = std::chrono::system_clock::now(); }
26 void End() { end_ = std::chrono::system_clock::now(); }
30 std::chrono::duration_cast<std::chrono::microseconds>(end_ - begin_);
31 return static_cast<double>(duration.count()) *
32 std::chrono::microseconds::period::num /
33 std::chrono::microseconds::period::den;
36 void PrintInfo(
const std::string& prefix =
"TimeCounter: ",
37 bool print_out =
true) {
41 FDLogger() << prefix <<
" duration = " << Duration() <<
"s." << std::endl;
45 std::chrono::time_point<std::chrono::system_clock> begin_;
46 std::chrono::time_point<std::chrono::system_clock> end_;
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16