Advertisement
donkaban

Untitled

May 21st, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1.  template <typename callable, typename ... arguments>
  2.     static float trace(callable && f, arguments &&... args)
  3.     {
  4.         std::function<typename std::result_of<callable(arguments...)>::type()>
  5.             task(std::bind(std::forward<callable>(f), std::forward<arguments>(args)...));
  6.         auto start = std::chrono::system_clock::now();
  7.         task();
  8.         std::chrono::duration<float> dt(std::chrono::system_clock::now() - start);
  9.         return dt.count();
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement