I like iostat, but...

David Wolfskill david at catwhisker.org
Mon Sep 22 21:22:11 UTC 2014


... I rather wish I could get the same information via sysctl.  (Well,
something seems to be available via the "opaque" kern.devstat.all
sysctl(8) variable, but sysctl(8) doesn't display all of it, and parsing
it seems as if that would require knowledge about the internals of the
system where the data were acquired.)

If iostat(8) could be taught to (optionally) provide a timestamp, that
might suffice.

The problem I'm trying to solve is this: I need to be able to acquire
various resource counters (along with timestamps), so I can post-process
the acquired data (generally, on a system other than the one where the
data were gathered) in order to be able to see how the
resource-consumption changes over the duration of a moderately
long-running task (typically. 0.5 - 8 hrs.).

I have (with some success) cobbled up a shell script to do much of
this.  (And yes, I've measured the behavior of some typical workloads
in this environment vs. merely running the workload under "/usr/bin/time
-lpo", with 5 test iterations for each, there was no statistically
significant difference with a 95% confidence interval.)

The script:

* Parses its arguments, and from that information constructs a command
  line (which invokes sysctl(8), and (optionally) netstat(1), and
  pipes that output through awk(1)).

* Determines the current time-of-day ("date +%s")

* Enters a loop, which:
  + "eval"s the constructed command line (causing a timestamped line of
    information to be spat out standard output); the timestamp is from
    the most-recently-acquired time-of-day.
  + Determines the current time-of-day ("date +%s").
  + Based on the desired sampling interval, calculates the number of
    seconds to sleep.  (If I could get strftime to format fractional
    seconds, that could be handy.)
  + Sleeps for the calculated interval.
  + Determines the current time-of-day ("date +%s").

And for most things I care about, it works fairly well.

Further, I do this as a shell script precisely so I don't need to build
a new version of the tool for a new target system: the script purposely
only requires tools that are in base FreeBSD, and requires no special
privilege to use.

For some sample graphs I have generated from this kind of data, please
see <http://www.catwhisker.org/~david/FreeBSD/bmake/>.

I believe that having an ability to correlate the "iostat -x"
information with the CPU, load average, and memory utilization would be
useful -- but I don't see a reasonable way to go about it.  If anyone
has suggestions, I'm listening. :-}

Peace,
david
-- 
David H. Wolfskill				david at catwhisker.org
Taliban: Evil cowards with guns afraid of truth from a 14-year old girl.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-performance/attachments/20140922/73e3b6a7/attachment.sig>


More information about the freebsd-performance mailing list