11 #ifndef HIGH_RES_CLOCK_HPP 12 #define HIGH_RES_CLOCK_HPP 14 #include <boost/config.hpp> 15 #include <boost/cstdint.hpp> 17 #if defined(ASIO_WINDOWS) 22 QueryPerformanceCounter(&i);
26 #elif defined(__GNUC__) && defined(__x86_64__) 30 unsigned long low, high;
31 __asm__ __volatile__(
"rdtsc" :
"=a" (low),
"=d" (high));
32 return (((boost::uint64_t)high) << 32) | low;
37 #include <boost/date_time/posix_time/posix_time_types.hpp> 41 boost::posix_time::ptime now =
42 boost::posix_time::microsec_clock::universal_time();
44 boost::posix_time::ptime epoch(
45 boost::gregorian::date(1970, 1, 1),
46 boost::posix_time::seconds(0));
48 return (now - epoch).total_microseconds();
53 #endif // HIGH_RES_CLOCK_HPP boost::uint64_t high_res_clock()