| 9 | |
| 10 | namespace NChromiumTrace { |
| 11 | TInstant GetThreadCPUTime() { |
| 12 | #ifdef _linux_ |
| 13 | struct timespec ts; |
| 14 | clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); |
| 15 | struct timeval tv; |
| 16 | tv.tv_sec = ts.tv_sec; |
| 17 | tv.tv_usec = ts.tv_nsec / 1000; |
| 18 | return TInstant(tv); |
| 19 | #else |
| 20 | // TODO: add implementations for win32/darwin, move to util |
| 21 | return TInstant(); |
| 22 | #endif |
| 23 | } |
| 24 | |
| 25 | TInstant GetWallTime() { |
| 26 | #ifdef _win_ |