summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-12-23 00:20:10 +0100
committerGitHub <noreply@github.com>2017-12-23 00:20:10 +0100
commit099ab661d00aaa29eb3ff00749fd851cdd15d4b5 (patch)
treeae3617908fc55e451117092020c1176ee0e68dee
parentc2da016469427b2ffebaab0d38ca36b81281420c (diff)
downloadbugzilla-099ab661d00aaa29eb3ff00749fd851cdd15d4b5.tar.gz
bugzilla-099ab661d00aaa29eb3ff00749fd851cdd15d4b5.tar.xz
no bug - support Devel::NYTProf
-rw-r--r--.circleci/config.yml2
-rw-r--r--Bugzilla/Extension.pm2
-rw-r--r--Bugzilla/Template/PreloadProvider.pm1
-rw-r--r--Dockerfile2
-rwxr-xr-xMakefile.PL1
-rw-r--r--mod_perl.pl21
-rw-r--r--vagrant_support/bashrc3
7 files changed, 28 insertions, 4 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 54f5381d5..9ff648b58 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -16,7 +16,7 @@ main_filters: &main_filters
defaults:
bmo_slim_image: &bmo_slim_image
- image: mozillabteam/bmo-slim:20170927.1
+ image: mozillabteam/bmo-slim:20171222.1
user: app
mysql_image: &mysql_image
diff --git a/Bugzilla/Extension.pm b/Bugzilla/Extension.pm
index baf2286e1..a41ac9326 100644
--- a/Bugzilla/Extension.pm
+++ b/Bugzilla/Extension.pm
@@ -46,7 +46,7 @@ sub INC_HOOK {
return 1;
}
else {
- $_ = qq{# line 0 "$real_file"\n};
+ $_ = qq{# line 1 "$real_file"\n};
$first = 0;
return 1;
}
diff --git a/Bugzilla/Template/PreloadProvider.pm b/Bugzilla/Template/PreloadProvider.pm
index 2588b1a79..bddabfa2e 100644
--- a/Bugzilla/Template/PreloadProvider.pm
+++ b/Bugzilla/Template/PreloadProvider.pm
@@ -43,6 +43,7 @@ sub _init {
}
trick_taint($name);
my $data = {
+ path => $name,
name => $key,
text => do {
open my $fh, '<:utf8', $name or die "cannot open $name";
diff --git a/Dockerfile b/Dockerfile
index 7de8088be..f4273eac6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM mozillabteam/bmo-slim:20170927.1
+FROM mozillabteam/bmo-slim:20171222.1
ARG CI
ARG CIRCLE_SHA1
diff --git a/Makefile.PL b/Makefile.PL
index dbf42fd1c..c8eb6dec5 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -66,6 +66,7 @@ my %requires = (
'URI' => '1.55',
'version' => '0.87',
'Taint::Util' => 0,
+ 'Devel::NYTProf' => 0,
);
my %build_requires = (
'ExtUtils::MakeMaker' => '7.22',
diff --git a/mod_perl.pl b/mod_perl.pl
index c682bece6..f94b7f7d4 100644
--- a/mod_perl.pl
+++ b/mod_perl.pl
@@ -24,6 +24,14 @@ BEGIN {
use Bugzilla::ModPerl::StartupFix;
+use constant USE_NYTPROF => !! $ENV{USE_NYTPROF};
+BEGIN {
+ if (USE_NYTPROF) {
+ $ENV{NYTPROF} = "savesrc=0:start=no:addpid=1";
+ }
+}
+use if USE_NYTPROF, 'Devel::NYTProf::Apache';
+
use Bugzilla::Constants ();
# If you have an Apache2::Status handler in your Apache configuration,
@@ -122,7 +130,7 @@ package Bugzilla::ModPerl::ResponseHandler;
use strict;
use base qw(ModPerl::Registry);
use Bugzilla;
-use Bugzilla::Constants qw(USAGE_MODE_REST);
+use Bugzilla::Constants qw(USAGE_MODE_REST bz_locations);
use Time::HiRes;
sub handler : method {
@@ -140,9 +148,20 @@ sub handler : method {
local *lib::import = sub {};
use warnings;
+ if (Bugzilla::ModPerl::USE_NYTPROF) {
+ state $count = {};
+ my $script = File::Basename::basename($ENV{SCRIPT_FILENAME});
+ $script =~ s/\.cgi$//;
+ my $file = bz_locations()->{datadir} . "/nytprof.$script." . ++$count->{$$};
+ DB::enable_profile($file);
+ }
Bugzilla::init_page();
my $start = Time::HiRes::time();
my $result = $class->SUPER::handler(@_);
+ if (Bugzilla::ModPerl::USE_NYTPROF) {
+ DB::disable_profile();
+ DB::finish_profile();
+ }
warn "[request_time] ", Bugzilla->cgi->request_uri, " took ", Time::HiRes::time() - $start, " seconds to execute";
# When returning data from the REST api we must only return 200 or 304,
diff --git a/vagrant_support/bashrc b/vagrant_support/bashrc
index e9764c7f2..d4dba9f40 100644
--- a/vagrant_support/bashrc
+++ b/vagrant_support/bashrc
@@ -8,4 +8,7 @@ fi
# User specific aliases and functions
PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] $ '
+export PERL5LIB=/vagrant/local/lib/perl5
+export PATH=/vagrant/local/bin:$PATH
+
cd /vagrant