12345678910111213141516 |
- static struct timeval tm1;
- static inline void start_clock()
- {
- gettimeofday(&tm1, NULL);
- }
- static inline void stop_clock()
- {
- struct timeval tm2;
- gettimeofday(&tm2, NULL);
- unsigned long long t = 1000 * (tm2.tv_sec - tm1.tv_sec) + (tm2.tv_usec - tm1.tv_usec) / 1000;
- printf("%llu ms\n", t);
- }
|