瀏覽代碼

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

George Baugh 2 月之前
父節點
當前提交
b99d29af51
共有 1 個文件被更改,包括 9 次插入 和 2 次删除
  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, $@);