Tweaks requested by Baron, plus fixes.

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 commit is contained in:
Brian Fraser
2012-02-01 19:12:03 -03:00
parent 7c4c186978
commit b0f7bc4fc6
8 changed files with 286 additions and 127 deletions

View File

@@ -386,11 +386,25 @@ sub group_by {
# object's ->new being smart about discarding unrecognized
# values.
$o->set("current_group_by_obj", undef);
#my $new_obj = $old_obj->new_from_object($input_to_object{$input});
$o->set( "current_group_by_obj", $input_to_object{$input}->new(OptionParser=>$o, interactive => 1) );
if ( !$args{redraw_all} ) {
print_header(%args);
}
my $new_obj = $input_to_object{$input}->new(OptionParser=>$o, interactive => 1);
$o->set( "current_group_by_obj", $new_obj );
# Data shared between all the objects.
# Current
$new_obj->{_stats_for} = $old_obj->{_stats_for};
$new_obj->set_curr_ts($old_obj->curr_ts());
# Previous
$new_obj->{_prev_stats_for} = $old_obj->{_prev_stats_for};
$new_obj->set_prev_ts($old_obj->prev_ts());
# First
$new_obj->{_first_stats_for} = $old_obj->{_first_stats_for};
$new_obj->set_first_ts($old_obj->first_ts());
# If we can't redraw the entire file, because there isn't a file,
# just settle for reprinting the header.
print_header(%args) unless $args{redraw_all};
}
# Just aliasing this for a bit.