Skip to content

Instantly share code, notes, and snippets.

@hashware
Created May 29, 2018 02:52
Show Gist options
  • Save hashware/7756b381a83d97ce789c6bd98df2af4a to your computer and use it in GitHub Desktop.
Save hashware/7756b381a83d97ce789c6bd98df2af4a to your computer and use it in GitHub Desktop.
static int cnt = 0;
cnt++;
{
struct timeval now;
gettimeofday(&now, NULL);
uint64_t us0 = 0;
static uint64_t us1 = 0;
us0 = (uint64_t)now.tv_sec * 1000000 + (uint64_t)now.tv_usec;
if (us1 != us0) {
uint64_t x = us0 - us1;
if (cnt % 100 == 0) {
printf("frame: %d\n", x);
}
us1 = us0;
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment