|
NAMEDevel::GraphVizProf - per-line Perl profiler (with graph output)SYNOPSISperl -d:GraphVizProf test.pl > test.dot dot -Tpng test.dot > test.png DESCRIPTIONNOTE: This module is a hack of Devel::SmallProf by Ted Ashton. It has been modified by Leon Brocard to produce output for GraphViz, but otherwise the only thing I have done is change the name. I hope to get my patches put into the main Devel::SmallProf code eventually, or alternatively read the output of Devel::SmallProf. Anyway, the normal documentation, which you can probably ignore, follows.The Devel::GraphVizProf profiler is focused on the time taken for a program run on a line-by-line basis. It is intended to be as "small" in terms of impact on the speed and memory usage of the profiled program as possible and also in terms of being simple to use. Those statistics are placed in the file smallprof.out in the following format: <num> <time> <ctime> <line>:<text> where <num> is the number of times that the line was executed, <time> is the amount of "wall time" (time according the the clock on the wall vs. cpu time) spent executing it, <ctime> is the amount of cpu time expended on it and <line> and <text> are the line number and the actual text of the executed line (read from the file). The package uses the debugging hooks in Perl and thus needs the -d switch, so to profile test.pl, use the command: perl5 -d:GraphVizProf test.pl Once the script is done, the statistics in smallprof.out can be sorted to show which lines took the most time. The output can be sorted to find which lines take the longest, either with the sort command: sort -k 2nr,2 smallprof.out | less or a perl script: open(PROF,"smallprof.out"); @sorted = sort {(split(/\s+/,$b))[2] <=> (split(/\s+/,$a))[2]} <PROF>; close PROF; print join('',@sorted); NOTES
OPTIONSGraphVizProf has 3 variables which can be used during your script to affect what gets profiled.
INSTALLATIONJust the usualperl Makefile.PL make make test make install and should install fine via the CPAN module. BUGSSubroutine calls are currently not under the control of %DB::packages. This should not be a great inconvenience in general.The handling of evals is bad news. This is due to Perl's handling of evals under the -d flag. For certain evals, caller() returns '(eval n)' for the filename and for others it doesn't. For some of those which it does, the array "@{'_<filename'}" contains the code of the eval. For others it doesn't. Sometime, when I've an extra tuit or two, I'll figure out why and how I can compensate for this. Comments, advice and questions are welcome. If you see inefficent stuff in this module and have a better way, please let me know. AUTHORTed Ashton <ashted@southern.edu>GraphVizProf was developed from code originally posted to usenet by Philippe Verdret <philippe.verdret@sonovision-itep.fr>. Special thanks to Geoffrey Broadwell <habusan2@sprynet.com> for his assistance on the Win32 platform and to Philippe for his patient assistance in testing and debugging. Copyright (c) 1997 Ted Ashton This module is free software; you can redistribute it or modify it under the Perl License, a copy of which is available at <http://dev.perl.org/licenses/>. SEE ALSODevel::DProf, Time::HiRes.
Visit the GSP FreeBSD Man Page Interface. |