> Rather than do system('uptime') and incur the process start-up each time,
> you could do fp = popen('vmstat 60', 'r'), then just read the fp.
popen doesn't incur a process start? Get real. But you're right, popen()
is the right call not system(), because you need to read the stdout.
> I believe vmstat is fairly standard.
Not more so than uptime --- and the latter's output format is definitely
less variable across platforms. The HPUX man page goes so far as to say
WARNINGS Users of vmstat must not rely on the exact field widths and spacing of its output, as these will vary
dependingon the system, the release of HP-UX, and the data to be displayed.
and that's just for *one* platform.
regards, tom lane