AutoProfiler - Automatically profile subroutine calls in a perl program. Copyright (C) 2001 Greg London This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Perl 5 License schemes for more details. contact the author via http://www.greglondon.com
AutoProfiler - Automatically profile subroutine calls in a perl program.
use AutoProfiler;
The profiler module is completely automatic in its basic mode. You simply "use" the module at the top of you main script. The module will then automatically instrument all subroutines in the code, profile each subroutine call during the execution of the script, and print out a report of usage. To use the AutoProfiler module in your program, just put this one line in your program: use Devel::AutoProfiler; everything else will happen automatically. AutoProfiler 1.1 handles prototyped subroutines. If you use a module that you do not want profiled, "use" that module before you "use" the AutoProfiler module. i.e. use ThisModuleWillNotBeProfiled; use Devel::AutoProfiler; use ThisModuleWillGetProfiled; When the program completes, the AutoProfiler module will automatically print out information about all subroutines that were profiled. You can supply a callback which will be called at END time. This code reference will be passed a hash containing all the caller information in the form of a hash. Your callback routine can the do whatever it wishes with this information. use Data::Dumper; use Devel::AutoProfiler ( -command => sub { my (%data) = @_; print "this format provided by user callback \n"; print Dumper \%data; } ); If you do not supply a callback command, AutoProfiler prints out the caller information in reverse order by total time spent in a particular subroutine. This means that at the end of execution, all the information is printed out, and the last item listed uses the most processor time during execution.
Every subroutine that exists at "INIT" time will be redefined to call an instrumented version of the subroutine.
Devel::AutoProfiler now comes with a makefile to officially install into you perl area. To install, download the tarball, and then type perl Makefile.PL make make test make install There are some sample scripts in the tarball that you can play with to view how AutoProfiler works: test.pl, wantarray.pl, and callback.pl
1 POD Error
The following errors were encountered while parsing the POD:
=for without a target?
To install Devel::AutoProfiler, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::AutoProfiler
CPAN shell
perl -MCPAN -e shell install Devel::AutoProfiler
For more information on module installation, please visit the detailed CPAN module installation guide.