Profiling a Perl CGI script that times-out

一笑奈何 提交于 2019-12-05 05:58:15

Setting sigexit=1 tells NYTProf to catch the following signals:

INT HUP PIPE BUS SEGV

However, when your CGI script times out, Apache sends SIGTERM. You need to catch SIGTERM:

sigexit=term

To catch SIGTERM in addition to the default signals, use:

sigexit=int,hup,pipe,bus,segv,term

CGI.pm has a debug mode, which you can use to run your program from the command line, and pass your CGI parameters as key/value pairs.

It has another feature that you can use to save your params to a file, and then read that file back in later.

What I've done is added the code to save the params to a file, and run my program, via a browser. This also facilitates my abilty to insure that the browser is sending the correct data.

Then I change the code to read the params from the file, and run it as often as I need until I have everything else debugged.

Once you've got the program running to your satisfaction from the command line, you can run it via nytprof to figure out what is taking all the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!