Bladeren bron

Fix call.pl chdir in wrong place, not setting up prof

George Baugh 2 maanden geleden
bovenliggende
commit
b99d29af51
1 gewijzigde bestanden met toevoegingen van 9 en 2 verwijderingen
  1. 9 2
      call.pl

+ 9 - 2
call.pl

@@ -35,11 +35,18 @@ our $app = sub {
     # We are debugging here
     $cfg{verbose} = 1;
 
+    # Change your dir into whatever basedir you need to be in
+    chdir($cfg{'basedir'}) || warn "Can't chdir to $cfg{'basedir'}: $_";
+
+    # If we have manually set the NYTPROF var, use it and don't try to control
+    # When to stop or start it.
+    $ENV{NYTPROF} ||= "sigexit=1:savesrc=0:start=no:file=$cfg{tpsgi_dir}/prof/nytprof.out";
+    require Devel::NYTProf;
+    mkdir "$cfg{tpsgi_dir}/prof";
+
     my $self = TPSGI->new(%cfg);
     local $@;
 
-    chdir($cfg{'basedir'}) || warn "Can't chdir to $cfg{'basedir'}: $_";
-
     return eval { $self->app(@_) } || do {
         my $env = shift;
         emit_error($env, $@);