Skip to content

Instantly share code, notes, and snippets.

@moio
Created April 22, 2022 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moio/1f50c268c48c8ece0b1f857838f75dca to your computer and use it in GitHub Desktop.
Save moio/1f50c268c48c8ece0b1f857838f75dca to your computer and use it in GitHub Desktop.
C program to check if the machine supports the RDTSCP instruction
#include <cpuid.h>
#include <stdio.h>
int main() {
unsigned a, b, c, d;
if (__get_cpuid(0x80000001, &a, &b, &c, &d) && (d & (1<<27)))
{
printf("RDTSCP is supported\n");
}
else
{
printf("RDTSCP is NOT supported\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment