B::Stats - print optree statistics
perl -MB::Stats myprog.pl # all perl -MO=Stats myprog.pl # compile-time only perl -MB::Stats[,OPTIONS] myprog.pl
Print statistics for all generated ops.
static analysis at compile-time, static analysis at end-time to include all runtime added modules, and dynamic analysis at run-time, as with a profiler.
The purpose is to help you in your goal:
no bloat;
Options can be bundled: -c,-e,-r eq -cer
-c,-e,-r
-cer
Do static analysis at compile-time. This does not include all run-time require packages. Invocation via -MO=Stats does this automatically.
Do static analysis at end-time. This is includes all run-time require packages. This calculates the heap space for the optree.
Do dynamic run-time analysis of all actually visited ops, similar to a profiler. Single ops can be called multiple times.
Same as -cer: static compile-time, end-time and dynamic run-time.
Tabular list of -c, -e and -r results.
Short summary only, no op class. With -t only the final table(s).
Prints included file names
Calculates the optree fragmentation. 0.0 is perfect, 1.0 is very bad.
A perfect optree has no null ops and every op->next is immediately next to the op.
Filter for op names and classes. Only calculate the given ops, resp. op class.
perl -MB::Stats,-fLOGOP,-fCOP,-fconcat myprog.pl
Print output only to this file. Default: STDERR
perl -MB::Stats,-llog myprog.pl
Static -c check at CHECK time. Triggered by -MO=Stats,-OPTS
Returns run-time count per op type.
Returns an AV ref for all opcounts, indexed by opcode.
Resets to opcount array for all ops to 0
General formatter
-r formatter.
Prepares count hash from the runtime generated structure in XS and calls output().
-t formatter
Does not work together with -r
This module is available under the same licences as perl, the Artistic license and the GPL.
To install B::Stats, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::Stats
CPAN shell
perl -MCPAN -e shell install B::Stats
For more information on module installation, please visit the detailed CPAN module installation guide.