I would like to check if my processor is AMD or INTEL in C and do necessary action according to that. What is the right and efficient way to get it in C?
Should i run system(linux command) or is there any other nice way to get it.
I would like to check if my processor is AMD or INTEL in C and do necessary action according to that. What is the right and efficient way to get it in C?
Should i run system(linux command) or is there any other nice way to get it.
Copyright © 2021 Jogjafile Inc.
Since You didn't point an OS you are working at here is how you do it for OSX
I think that in c it is the same library just called by
#include
To useuint64_t
type value you should include<stdint.h>
The answer you will get will be stored in
freq
To know the name of
sysctlbyname
you can runsysctl -a
in terminalI think that
sysctl
is also compatible with linux but I never test it on linux machinehttp://www.unix.com/man-page/freebsd/3/sysctlbyname/