summaryrefslogtreecommitdiffstats
path: root/show_bug.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'show_bug.cgi')
-rwxr-xr-xshow_bug.cgi19
1 files changed, 16 insertions, 3 deletions
diff --git a/show_bug.cgi b/show_bug.cgi
index a2bf57ada..99679f7ad 100755
--- a/show_bug.cgi
+++ b/show_bug.cgi
@@ -30,12 +30,16 @@ use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Keyword;
use Bugzilla::Bug;
+use Bugzilla::Instrument;
+
+my $timings = Bugzilla::Instrument->new('show_bug');
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
my $user = Bugzilla->login();
+$timings->time('login_time');
my $format = $template->get_format("bug/show", scalar $cgi->param('format'),
scalar $cgi->param('ctype'));
@@ -61,7 +65,7 @@ Bugzilla->switch_to_shadow_db unless $user->id;
if ($single) {
my $id = $cgi->param('id');
- push @bugs, Bugzilla::Bug->check($id);
+ push @bugs, Bugzilla::Bug->check({ id => $id, cache => 1 });
if (defined $cgi->param('mark')) {
foreach my $range (split ',', $cgi->param('mark')) {
if ($range =~ /^(\d+)-(\d+)$/) {
@@ -77,8 +81,8 @@ if ($single) {
foreach my $id ($cgi->param('id')) {
# Be kind enough and accept URLs of the form: id=1,2,3.
my @ids = split(/,/, $id);
- foreach (@ids) {
- my $bug = new Bugzilla::Bug($_);
+ foreach my $bug_id (@ids) {
+ my $bug = new Bugzilla::Bug({ id => $bug_id, cache => 1 });
# This is basically a backwards-compatibility hack from when
# Bugzilla::Bug->new used to set 'NotPermitted' if you couldn't
# see the bug.
@@ -89,8 +93,10 @@ if ($single) {
}
}
}
+$timings->time('load_bug_time');
Bugzilla::Bug->preload(\@bugs);
+$timings->time('preload_time');
$vars->{'bugs'} = \@bugs;
$vars->{'marks'} = \%marks;
@@ -128,3 +134,10 @@ print $cgi->header($format->{'ctype'});
$template->process($format->{'template'}, $vars)
|| ThrowTemplateError($template->error());
+$timings->time('template_time');
+
+if (scalar(@bugids) == 1) {
+ $timings->label('bug-' . $bugs[0]->id);
+ $timings->label('user-' . $user->id);
+ $timings->log();
+}