/ Published in: C

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct timeval start, end, delta; // LAPS should be huge (about a million, probably) for (int i = 0; i < LAPS; i++) test_function(); timersub(&end, &start, &delta); uint64_t delta_ns = (delta.tv_sec * NSEC_PER_SEC + delta.tv_usec * NSEC_PER_USEC) / LAPS;
Comments
