]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
no bug - support Devel::NYTProf
authorDylan William Hardison <dylan@hardison.net>
Fri, 22 Dec 2017 23:20:10 +0000 (18:20 -0500)
committerGitHub <noreply@github.com>
Fri, 22 Dec 2017 23:20:10 +0000 (18:20 -0500)
.circleci/config.yml
Bugzilla/Extension.pm
Bugzilla/Template/PreloadProvider.pm
Dockerfile
Makefile.PL
mod_perl.pl
vagrant_support/bashrc

index 54f5381d53a50745f141d5057dc5dc461ee2a465..9ff648b589008b8e7d2932e666c48ed95d1727c3 100644 (file)
@@ -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
index baf2286e1117b80b92e49888ee1997725a98c79a..a41ac9326ca015d3eab8afc32a3ad58a04f8fecb 100644 (file)
@@ -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;
             }
index 2588b1a7913581d8e9f2a58ea81f22e02e34af96..bddabfa2e77e6215558e294407a11155fed282f6 100644 (file)
@@ -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";
index 7de8088be40ac5b9fa177cf5fe0365d64308e579..f4273eac6d2b1c1cdd991589cdb9455e08b09428 100644 (file)
@@ -1,4 +1,4 @@
-FROM mozillabteam/bmo-slim:20170927.1
+FROM mozillabteam/bmo-slim:20171222.1
 
 ARG CI
 ARG CIRCLE_SHA1
index dbf42fd1cfaf7c250d888ad91979e82faddb037d..c8eb6dec5eba92d3d0c9df1d6c361c5178ef885b 100755 (executable)
@@ -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',
index c682bece685e208cae7859dbb0093214a3930b90..f94b7f7d42b6ba90186d58c1380cb7a08ab2a39f 100644 (file)
@@ -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,
index e9764c7f2099709b459a273a6581ff2494c64e98..d4dba9f40d4d38cd94a07904d0c1db47e8a46968 100644 (file)
@@ -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