| 25 | namespace { |
| 26 | |
| 27 | long timespec_diff_us(const timespec& ts1, const timespec& ts2) { |
| 28 | return (ts1.tv_sec - ts2.tv_sec) * 1000000L + |
| 29 | (ts1.tv_nsec - ts2.tv_nsec) / 1000; |
| 30 | } |
| 31 | |
| 32 | // A simple class, could keep track of the time when it is invoked. |
| 33 | class TimeKeeper { |