goupilInside has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow Monks.
I have encountered a tiny annoyance that has me seeking your knowledge.
I have a script, a CGI, using Class::DBI running far too slow that I must "cure".
It is not a very fancy script but it calls a lot of external modules particular to the project.
The platform is Linux and Perl version is 5.8.8.
I'm testing it from the command line to avoid interactions with the web server.
"Yipee" I thought, "I will be using those crazy profiling facilities Perls offer".
And so I proceeded.
After reading some holy writings of St D Foy and the laws of the CPAN, I tried to start using DProf.
Alas, poor me, the program starts but then produces a tense and pretty insulting "segmentation fault" -- then dies.
The resulting tmon.out seems truncated and only contains information regarding environment startup.
Retrying with strace shows me a long serial of memory allocations before the segfault (brk).
Being still joyful and naive, I moved to Devel::Profiler, the CPAN having warned me of the possible deprecation of the old DProf ways.
This time, the process started, ate 2G of RAM, then 2G of swap and proceeded to freeze the computer.
"Well", said I, "why not trying Devel::SmallProf".
It worked ... sort of.
It did not crash or freeze, but produced an empty "smallprof.out" .
Devel::FastProf produced a 4K fastprof.out file containing nothing useful (with or without withfork option)
DBI::Profile is working well and indicating that the DB aspects are mostly correct, so I'd really like to be able to profile the sneaks of client side code.
Beside being stuck on the head until Satori, I seem to have tried every reasonable way.
Is there some wise voice in here who would show an humble disciple the way of illumination ?
UPDATE:
It turns out to be quite stupid and fully due to my script.
I have some module called lib/TheProject/DB.pm containing mostly the connection management and some small tools common to all DB oriented classes.
Then all Dabases classes are in modules like lib/TheProject/DB/SomeDBBackedClasses.pm, which requires using TheProject::DB.
Except that one of the developpers (it can't be me, can it ? ...cof, cof), has typed use DB; instead of use TheProject::DB;, including the Debugging related libraries causing a mess of respectable proportions (it still worked because below he/she/it added a use TheProject::DB.
Removing the guilty use makes all the profilers happy.
Thanks to all who answered and gave me directions.
/me is going to check in the SVN whom to apply the clue stick to.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Profiling woes
by perrin (Chancellor) on Apr 09, 2008 at 13:02 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 15:35 UTC | |
|
Re: Profiling woes
by derby (Abbot) on Apr 09, 2008 at 12:04 UTC | |
by perrin (Chancellor) on Apr 09, 2008 at 12:55 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 15:41 UTC | |
|
Re: Profiling woes
by stiller (Friar) on Apr 09, 2008 at 11:29 UTC | |
by apl (Monsignor) on Apr 09, 2008 at 11:53 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 15:24 UTC | |
by perrin (Chancellor) on Apr 09, 2008 at 12:57 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 15:33 UTC | |
|
Re: Profiling woes
by jplindstrom (Monsignor) on Apr 09, 2008 at 13:31 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 15:37 UTC | |
|
Re: Profiling woes
by salva (Canon) on Apr 09, 2008 at 13:10 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 15:40 UTC | |
by salva (Canon) on Apr 09, 2008 at 16:29 UTC | |
by goupilInside (Sexton) on Apr 09, 2008 at 18:38 UTC |