Using C++, is there a way I could get basic information about the computer?
For example, is there a way I could check how much memory is being used (by the whole computer not just my computer), the total memory available, virtual memory usage, CPU usage, networks stats and so on?
I am using Mac OS X v10.6 (Snow Leopard), but I would prefer a solution that could be implemented for all Mac OSs (for example, Mac OS X v10.7 (Lion)).
For system-wide memory usage information under Mac OS X, open and read the file /usr/bin/vm_stat. Something like this:
For a CPU usage indicator, do something like this:
For network statistics, I don’t know the solution (other than maybe to run netstat and parse the results somehow… it depends on what network statistics you are interested in I suppose).