views:

45

answers:

0

When you run top or Activity Monitor on OS X, you see a variety of performance data for the whole system - current and historic CPU usage, physical memory and swap space usage, disk activity, and so on. On Linux and some other Unixen, you can access this data in your own programs using syscalls or looking in the /proc and/or /sys pseudo-filesystems.

Unfortunately, OS X lacks both /proc and /sys, and casual googling doesn't reveal many syscalls that provide whole-computer performance data. Hence this question:

How might you access Mac OS X system performance data from your C program?