[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 ?
    --
    View this message in context: http://www.nabble.com/-c%2B%2B-Retrieving-system-information-tp17262844p172
    62844.html

    Sent from the OmniGroup - MacOSX-Dev mailing list archive at Nabble.com.
  • 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/
  • 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...>
    > http://www.omnigroup.com/mailman/listinfo/macosx-dev
    >
    >

    --
    View this message in context: http://www.nabble.com/-c%2B%2B-Retrieving-system-information-tp17262844p172
    76803.html

    Sent from the OmniGroup - MacOSX-Dev mailing list archive at Nabble.com.
previous month may 2008 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Go to today