On Wed, Oct/17/2007 04:01:43PM, Jeff Squyres wrote: > There was no patch attached... > > On Oct 17, 2007, at 3:18 PM, Ethan Mallove wrote: > > > WHAT: Add timing info to DoCommand::Cmd > > > > WHY: Need visibility into how long individual commands are > > taking (right now we only time entire phases). > > > > WHERE: DoCommand.pm, client/mtt, Messages.pm > > > > WHEN: ASAP > > > > ------- > > > > I need to see how long individual commands are taking within > > an MTT run. There is a Benchmark core module (available > > everywhere) to help with this. I would like to have this > > feature enabled with a --benchmark-command (-b) option. > > (Note: this can not be part of the --debug option --debug or > > --verbose options since these options affect the execution > > time of commands.) See attached patch. (Or should this > > somehow work together with --print-time?) > > > > -Ethan > > _______________________________________________ > > mtt-devel mailing list > > mtt-de...@open-mpi.org > > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-devel > > > -- > Jeff Squyres > Cisco Systems > > _______________________________________________ > mtt-devel mailing list > mtt-de...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-devel
Index: lib/MTT/DoCommand.pm =================================================================== --- lib/MTT/DoCommand.pm (revision 1084) +++ lib/MTT/DoCommand.pm (working copy) @@ -20,6 +20,7 @@ use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); use MTT::Messages; use Data::Dumper; +use Benchmark;
#-------------------------------------------------------------------------- @@ -169,6 +170,8 @@ my ($merge_output, $cmd, $timeout, $max_stdout_lines, $max_stderr_lines) = @_; + my $start = new Benchmark; + Debug("Running command: $cmd\n"); # Perl kills me here. It does its own buffering of pipes which @@ -429,6 +432,12 @@ $msg .= "\n"; Debug($msg); + # Display benchmark info + + my $finish = new Benchmark; + my $timediff = timediff($finish, $start); + Timing($cmd, timestr($timediff)); + # Return an anonymous hash containing the relevant data $ret->{result_stdout} = join('', @out);