~percona-toolkit-dev/percona-toolkit/pt-diskstats-2.0

« back to all changes in this revision

Viewing changes to lib/DiskstatsMenu.pm

  • Committer: Brian Fraser
  • Date: 2012-02-01 22:12:03 UTC
  • Revision ID: brian.fraser@percona.com-20120201221203-q2feng8fah0cvonc
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
386
386
      # object's ->new being smart about discarding unrecognized
387
387
      # values.
388
388
      $o->set("current_group_by_obj", undef);
389
 
      #my $new_obj = $old_obj->new_from_object($input_to_object{$input});
390
 
      $o->set( "current_group_by_obj", $input_to_object{$input}->new(OptionParser=>$o, interactive => 1) );
391
 
      if ( !$args{redraw_all} ) {
392
 
         print_header(%args);
393
 
      }
 
389
      my $new_obj = $input_to_object{$input}->new(OptionParser=>$o, interactive => 1);
 
390
      $o->set( "current_group_by_obj", $new_obj );
 
391
 
 
392
      # Data shared between all the objects.
 
393
      # Current
 
394
      $new_obj->{_stats_for}  = $old_obj->{_stats_for};
 
395
      $new_obj->set_curr_ts($old_obj->curr_ts());
 
396
 
 
397
      # Previous
 
398
      $new_obj->{_prev_stats_for}  = $old_obj->{_prev_stats_for};
 
399
      $new_obj->set_prev_ts($old_obj->prev_ts());
 
400
 
 
401
      # First
 
402
      $new_obj->{_first_stats_for} = $old_obj->{_first_stats_for};
 
403
      $new_obj->set_first_ts($old_obj->first_ts());
 
404
 
 
405
      # If we can't redraw the entire file, because there isn't a file,
 
406
      # just settle for reprinting the header.
 
407
      print_header(%args) unless $args{redraw_all};
394
408
   }
395
409
 
396
410
   # Just aliasing this for a bit.