2010-08-17 18:05:54 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
# this program is a performance measurement wrapper around anything that it is
|
|
|
|
# called with; it's arg-1 becomes the program being measured, with arg-2
|
|
|
|
# onwards being arg-1's arguments
|
|
|
|
|
|
|
|
# sorta like the "time" command... hence the name :-)
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# find the rc file, then pull the libraries
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# see notes on this code in gl-auth-command
|
|
|
|
BEGIN {
|
|
|
|
# find and set bin dir
|
|
|
|
$0 =~ m|^(/)?(.*)/| and $ENV{GL_BINDIR} = ($1 || "$ENV{PWD}/") . $2;
|
|
|
|
}
|
|
|
|
|
|
|
|
use lib $ENV{GL_BINDIR};
|
|
|
|
use gitolite_rc;
|
|
|
|
use gitolite_env;
|
|
|
|
use gitolite qw(log_it);
|
|
|
|
|
2010-08-17 18:05:54 +02:00
|
|
|
use Time::HiRes qw(gettimeofday tv_interval);
|
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# start...
|
|
|
|
# ----------------------------------------------------------------------------
|
2010-08-17 18:05:54 +02:00
|
|
|
|
|
|
|
# rc file
|
|
|
|
do "$ENV{HOME}/.gitolite.rc";
|
|
|
|
# this file is always in a fixed place; code in the main gitolite that
|
|
|
|
# seems to indicate it is not, is obsolete and needs to be fixed.
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
|
|
|
|
my $starttime = [gettimeofday];
|
|
|
|
|
|
|
|
my $pgm = shift;
|
|
|
|
my $returncode = system($pgm, @ARGV);
|
|
|
|
$returncode >>= 8;
|
|
|
|
$ENV{GL_USER} = shift;
|
|
|
|
|
|
|
|
my $elapsedtime = tv_interval($starttime);
|
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
$ENV{GL_LOG} = get_logfilename($GL_PERFLOGT);
|
2010-08-17 18:05:54 +02:00
|
|
|
# log_it logs to $ENV{GL_LOG}
|
2011-01-15 16:39:56 +01:00
|
|
|
log_it("", "$elapsedtime\trc=$returncode");
|