[c++]Retrieving system information
I'm working with c++ language and I'm trying to collect as much a information as possible on a MAC OS system like ,
nb of cpu,
frequency
usage of cpu
memory
usage of mem
list of process and their cpu usage
...
I searched a bit and it seems that sysctl may be the best to collect most of the needed information but I get odd results for some request like hw.cpufrequency although i get the correct output while using the terminal command.
exemple of request
int frequency;
len = sizeof(frequency);
if (sysctlbyname("hw.cpufrequency", &frequency, &len, NULL, 0) == -1){
std::cout << "error";
}
else{
std::cout << "frequency of processor " << frequency << std::endl;
}
This gives me an error while searching for hw.busfrequency works well.
Am i looking at the right tools for this kind of job ?