Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C: Print the USER_HZ for a platform
/* CPU values in /proc/stat are measured in USER_HZ which is
generally 1/100th of a second, but you can verify with this.
See http://man7.org/linux/man-pages/man5/proc.5.html
*/
#include <unistd.h>
#include <stdio.h>
int main()
{
printf("USER_HZ is %d\n", sysconf(_SC_CLK_TCK));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment