![]() |
![]()
| ![]() |
![]()
NAMEDevel::DProfPP - Parse "Devel::DProf" output SYNOPSISuse Devel::DProfPP; my $pp = Devel::DProfPP->new; Devel::DProfPP->new( file => "../tmon.out", enter => sub { my ($self, $sub_name) = shift; my $frame = ($self->stack)[-1]; print "\t" x $frame->height, $frame->sub_name; } )->parse; DESCRIPTIONThis module takes the output file from Devel::DProf (typically tmon.out) and parses it. By hooking subroutines onto the "enter" and "leave" events, you can produce useful reports from the profiling data. METHODSnewnew( file => $file, enter => \&entersub_code, leave => \&leavesub_code ); Creates a new parser object. All parameters are optional. See below for more information about what the enter and leave hooks can do. parseThis parses the profiler output, running the enter and leave hooks, and gathering information about subroutine timings. stackDuring the parsing run, "$pp-"gt"stack" will return a list of "Devel::DProfPP::Frame" objects. (See below) These can be examined for the profile timings. headerThis returns a hash of the header information, whose keys are:
HOOKSThe "enter" and "leave" hooks are called every time a subroutine is, predictable, entered or left. In each case, the parser and name of the subroutine are passed in as parameters to the hook, and everything else can be accessed through the parser object and the stack. FRAME OBJECTSThe following methods are available on a "Devel::DProfPP::Frame" object: timesinc_timescum_timesThese return the current execution time for a stack frame individually, for the stack frame and all of its descendants, and for all instances of this code. These times are given in seconds, but DO NOT include compensation for subroutine enter/leave overheads. If you want to compensate for these, subtract the appropriate overhead value from "$pp->header". heightThe height of this stack frame - 1 for the first subroutine call on the stack, 2 for the second, and so on. sub_nameThe fully qualified name of this subroutine. BUGSUnderstanding how "dprofpp"'s overhead compensation code works is Not Easy and has meant that I haven't tried to apply overhead compensation in this module. All the data's there if you want to do it yourself. The numbers produced by "Devel::DProf" are pseudorandom anyway, so this omission should't make any real difference. AUTHORSimon Cozens is the original author. Currently maintained by Steve Peters, "steve@fisharerojo.org" LICENSEYou may distribute this module under the same terms as Perl itself.
|