18
use File::Basename qw(basename);
19
binmode STDOUT, ':utf8';
20
21
+our $t0;
22
+if (eval { require Time::HiRes; 1; }) {
23
+ $t0 = [Time::HiRes::gettimeofday()];
24
+}
25
+our $number_of_git_cmds = 0;
26
+
27
BEGIN {
28
CGI->compile() if $ENV{'MOD_PERL'};
29
}
400
'sub' => \&feature_avatar,
401
'override' => 0,
402
'default' => ['']},
403
+
404
+ # Enable displaying how much time and how many git commands
405
+ # it took to generate and display page. Disabled by default.
406
+ # Project specific override is not supported.
407
+ 'timed' => {
408
+ 'override' => 0,
409
+ 'default' => [0]},
410
);
411
412
sub gitweb_get_feature {
520
521
# version of the core git binary
522
our $git_version = qx("$GIT" --version) =~ m/git version (.*)$/ ? $1 : "unknown";
523
+$number_of_git_cmds++;
524
525
$projects_list ||= $projectroot;
526
1969
1970
# returns path to the core git executable and the --git-dir parameter as list
1971
sub git_cmd {
1972
+ $number_of_git_cmds++;
1973
return $GIT, '--git-dir='.$git_dir;
1974
}
1975
3220
}
3221
print "</div>\n"; # class="page_footer"
3222
3223
+ if (defined $t0 && gitweb_check_feature('timed')) {
3224
+ print "<div id=\"generating_info\">\n";
3225
+ print 'This page took '.
3226
+ '<span id="generating_time" class="time_span">'.
3227
+ Time::HiRes::tv_interval($t0, [Time::HiRes::gettimeofday()]).
3228
+ ' seconds </span>'.
3229
+ ' and '.
3230
+ '<span id="generating_cmd">'.
3231
+ $number_of_git_cmds.
3232
+ '</span> git commands '.
3233
+ " to generate.\n";
3234
+ print "</div>\n"; # class="page_footer"
3235
+ }
3236
+
3237
if (-f $site_footer) {
3238
insert_file($site_footer);
3239
}