delphix/performance-diagnostics

estat: remove mandatory final positional duration argument

sebroy opened this issue · 0 comments

Positional arguments make it hard to extend the syntax of the command-line, and can be ambiguous if there are more than one. The estat command has one mandatory positional arguments for all but one of its scripts, which is the duration argument. From the usage:

delphix@guild:/var/log$ estat -h
USAGE: /usr/bin/estat -h
       /usr/bin/estat [prog] [options]

  Tool for running eBPF programs for monitoring performance of various I/O
  related subsystems, focusing on I/O latency. Output can be displayed has
  histograms of I/O broken down by size and type, depending on the provided
  arguments.

OPTIONS:

     -h    show this help message and exit

  estat backend-io    [options] <duration>
  estat iscsi         [options] <duration>
  estat nfs           [options] <duration>
  estat nfs-by-client [options] <duration>
  estat zio           [options] <duration>
  estat zio-queue     [options] <duration>
  estat zpl           [options] <duration>
  estat zvol          [options] <duration>
      Executes the specified tracing program for <duration> seconds, displaying
      various histograms detailing the I/O latency as seen by the particular
      subsystem.

      -m        monitor mode; emit data periodically
      -M        monitor mode; emit accumulated data periodically
      -a ARG    argument to the BCC script
      -l/-L     enable/disable latency histograms (default: on)
      -z/-Z     enable/disable size histograms (default: off)
      -q/-Q     enable/disable latency histograms by size (default: off)
      -y/-Y     enable/disable the summary output (default: on)
      -n/-N     enable/disable normalizing summary by time (default: on)
      -t/-T     enable/disable emitting the summary total (default: on)
      -d LEVEL  set BCC debug level
      -e        emit the resulting eBPF script without executing it

  estat zil [options]
      Provides a breakdown of time spent doing ZIL-related activities, in
      particular the time spent allocating a block and time spent waiting for
      the write I/O to complete.

      -a pool   the pool to trace

The duration should be made into an optional command-line option (like the other options) with a default value. This would mean that the zil subcommand would need to support a duration (which would be a good thing anyway).