http://www.perlmonks.org?node_id=949931


in reply to Re^12: "Automated" benchmarking
in thread "Automated" benchmarking

both Devel::SmallProf and Devel::NYTProf are not counting lines but "sentences" executed

Okay. I guess have to take that as read.

I'm still intrigued by the extra 3 'sentences' for the sleep in aaa() though?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^14: "Automated" benchmarking
by salva (Canon) on Jan 25, 2012 at 17:40 UTC
    From perldebguts:

    When the execution of your program reaches a point that can hold a breakpoint, the "DB::DB()" subroutine is called if any of the variables $DB::trace, $DB::single, or $DB::signal is true.

    And that's what Devel::SmallProf and Devel::NYTProf are counting, calls to DB::DB().

      I wasn't doubting you. Just still puzzling how a subroutine that is called 5000 times can result in 5003 sentences?

      In the other cases, it is fairly easy to see how xxx() for ... ; could result in double the number of sentence as there are lines.

      But those odd 3 are just beyond my ability to reason.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        With perl 5.8.9 on Linux, replacing the calls to Win32::Sleep by calls to Time::HiRes::nanosleep, I get the expected count of 5000.

        Probably, that 3 extra sentences are from some callback run from Win32::Sleep the first time it is called. Maybe you could use Devel::Trace or single step through the debugger to see what's going on.