Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Why does Devel::DProf report so much time in BEGIN?

( #102496=categorized question: print w/ replies, xml ) Need Help??
Contributed by koolade on Aug 06, 2001 at 20:32 UTC
Q&A  > debugging


Description:

Using Devel::DProf on some of my programs produces output such as is found at Devel::Dprof is your friend, where most of the time is shown in MODULE::BEGIN. Does anyone know what that means when there are no BEGIN blocks in the module? Or does it just represent total calls to that module's subs?

Answer: Why does Devel::DProf report so much time in BEGIN?
contributed by mikfire

Without seeing your code, but having spent some time with Devel::DProf myself, I will guess that you are use'ing a number of modules.

If I remember correctly,

use foo;
is implemented as
BEGIN { require foo; import foo; }
So, even though you are not explicitly using BEGIN blocks, you are using them implicitly through any use statements.

I would delve into the correct manpages and verify my memory, but I am far from any machine with perl installed on it :( And I have no ssh to get to a machine I could so use.

mikfire

Answer: Why does Devel::DProf report so much time in BEGIN?
contributed by Anonymous Monk

After tirelessly searching for an answer to the same question (hence the search that turned up this page as a result), I ended up just tweaking my code until I got an answer. Several of my subroutines were missing from the DProf report until I removed all "use strict" and "use vars" lines from my code.

I really have no idea why this made a difference. Sure would be nice if it were better-documented.

Anyway, not sure if this helps you out 9 months after the fact, but thought I would share.

--Bob

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (14)
    As of 2014-07-23 21:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (152 votes), past polls