Date: Wed, 14 Aug 2002 08:32:53 -0600 From: Tillman Hodgson <tillman@seekingfire.com> To: freebsd-questions@freebsd.org Subject: Extracting the 1-minute loadavg in a portable yet low-impact fashion Message-ID: <20020814083253.C11913@seekingfire.com>
next in thread | raw e-mail | index | archive | help
Howdy,
I'm trying to extract the 1-minute loadavg in a portable (between RedHat
Linux and FreeBSD, at least) way without having to invoke a lot of
expensive subprocesses. On Linux, awk '{print \$1}' < /proc/loadavg
has been working nicely (though non-portably). When I log onto a BSD
host and my NFS-mounted home dir follows me, this obviously doesn't work
very well :-)
uptime | awk '{print $10}' works, but leaves a trailing comma. Adding a
sed statement to the end of that would start to get too expensive.
sysctl vm.loadavg | awk '{print $3}' works on FreeBSD, but isn't
portable back to Linux.
Anything else that simple and inexpensive that I'm missing?
TIA,
- Tillman
--
Never appeal to a man's "better nature." He may not have one. Invoking
his self-interest gives you more leverage.
Robert Heinlein
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020814083253.C11913>
