Tweaks:
* --headers command line option, which can be used to
enable/disable the automatic headers, and the
automatic empty lines between samples.
* --show-timestamps, which changes the #ts line with
a timestamp in the HH:MM:SS format.
* Always use ReadKeyMini, even when we have Term::ReadKey.
In the latter case, use the Term::ReadKey functions,
but if they fail, try again with our own versions.
Fix:
Looks like I forgot to actually enable the "save the current, first
and last" samples. This is now on. It should mean faster and better
output when changing --group-by modes.
This fixes two bugs -- One a rounding error, one a desyncronization
between the main program and the data gathering daemon.
Additionally, it changes how the daemon prints the very first
sample. Before it would unconditionally wait until the time was
%$sample-time, which meant that in a worst case scenario,
a user could be left waiting for a while before seeing a line
of output.
This commit changes that first wait to only sleep if less
than 20% away from %$sample-time.
Originally, DiskstatsMenu differentiated between an empty pattern
entered by the user (which in the shell version meant "match all")
and any other valid pattern by replacing it with /(?=)/.
However, Diskstats now carries the original string, inside the
OptionParser object, so the above was redundant.
Still TODO: Attributes still have a single method that doubles
as a getter and setter. The constructor for Diskstats is still
weird -- A tad more stricter than it should be, if anything.
->print_rest is still rest, even though that's hardly
memorable, mostly because of a lack of ideas on what to
rename it. The main loop in the Menu is still a while (1).
As a nice perk, it's nearly twice as fast now! It also adds a
_very_ experimental --memory-for-speed argument, which
turns on memoization for the current biggest bottleneck.
Missing a doc overhaul and tests, but this deals with most of the
feature upgrades in the blueprint.
The shell version of pt-diskstats is now in bin has pt-diskstats-shell,
in case that's needed.
With this most of the interactive mode should be working.
pt_diskstats.pm has the documentation and can be used for testing,
which should be in the next commit.
This commit also includes the revamped command line options.
Mostly bits and pieces at the moments. ReadKeyMini is a portable-ish
Term::ReadKey. Used here by DiskstatsMenu, which is currently only
for show.
Diskstats has most of the logic of the old pt-diskstats, with parts
now implemented by the DiskstatsGroupBy* classes; The latter subclass
the former.
As mentioned at the start, this is a work in progress. In addition to to
not having all the parts attached, also missing are the data-gathering mode,
the command-line argument parsing, and a large amount of tests.