Here is one of the ways that can cause these messages
junk.pm
package junk; use strict; use warnings; use Exporter qw[ import ]; our @ISA = 'Exporter'; our @EXPORT_OK = qw[ test test2 ]; sub test{ print 'test' } sub test2{ print 'test2'; goto &test; } 1;
junk.pl
#! perl -slw use strict; use junk qw[ test test2 ]; test; test2;
Profiling output
C:\test>perl -d:DProf junk.pl test test2 test C:\test>dprofpp tmon.out junk::test has 1 unstacked calls in outer junk::test2 has -1 unstacked calls in outer Total Elapsed Time = 0.014928 Seconds User+System Time = 0.015928 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 0.00 - -0.000 1 - - strict::bits 0.00 - -0.000 1 - - warnings::BEGIN 0.00 - -0.000 1 - - warnings::import 0.00 - -0.000 2 - - junk::test 0.00 - -0.000 2 - - strict::import 0.00 - -0.000 2 - - Exporter::import 0.00 - -0.000 1 - - junk::test2 0.00 - -0.000 3 - - junk::BEGIN 0.00 - -0.000 2 - - main::BEGIN
The use of the "magic" goto in subroutine test2(), goto &test, is an optimisation that is sometimes usefully used by packages. It's effect is to transfer control from the first subroutine to the second in such a way as to ensure that when the second subroutine returns, control is transferred directly back to the original caller, rather than back through the first subroutine. This can be used to implement a form of the 'tail call optimisation'.
As dprof tracks and logs entry and exits to subroutines and then tries to match them when calculating the timing information, this one-way transfer of control confuses it's matching process and the warnings you see reflect that.
Either ignore the warnings, or use one of the line-by-line profilers which time each line, rather than each subroutine as so do not become confused. They are often more useful, though the profiling process is necessarily much slower.
In reply to Re: Errors when using DProf to profile
by BrowserUk
in thread Errors when using DProf to profile
by bowei_99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |