[c++]Retrieving system information

View: New views
3 Messages — Rating Filter:   Alert me  

[c++]Retrieving system information

by Coockie_jr () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 ?

Re: [c++]Retrieving system information

by Markus Hitter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Am 16.05.2008 um 15:32 schrieb Coockie_jr:
> Am i looking at the right tools for this kind of job ?

System Profiler has a command line interface: man system_profiler


Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/




_______________________________________________
MacOSX-dev mailing list
MacOSX-dev@...
http://www.omnigroup.com/mailman/listinfo/macosx-dev

Re: [c++]Retrieving system information

by Coockie_jr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

System_profiler seems to give most of the "statics" information I need but it doesn't give any dynamic information like cpu usage etc..
I guess I'll have to sick to sysctl.


Markus Hitter wrote:
Am 16.05.2008 um 15:32 schrieb Coockie_jr:
> Am i looking at the right tools for this kind of job ?

System Profiler has a command line interface: man system_profiler


Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/




_______________________________________________
MacOSX-dev mailing list
MacOSX-dev@omnigroup.com
http://www.omnigroup.com/mailman/listinfo/macosx-dev