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

DProf output of named functions.

by regexes (Hermit)
on Sep 25, 2007 at 12:45 UTC ( #640916=perlquestion: print w/replies, xml ) Need Help??

regexes has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,

I have a simple program which parses an XML file and does "stuff". I use it on different OSes.

I have read the profiling tutorial here: Profiling your code.

I'm having a problem understanding why some of the output under Name differs between OSes, i.e. the functions differ. I would have thought they would be the same. I'm confident that someone here can explain the error in my thought process. ;-)

Take the following... (I've cut it to show only the relevant part..)

Total Elapsed Time = 1.292316 Seconds User+System Time = 0.282316 Seconds Name XML::SAX::PurePerl::Reader::URI::new XML::SAX::PurePerl::BEGIN main::BEGIN XML::Simple::find_xml_file main::ParseFile XML::SAX::PurePerl::Productions::BEGIN strict::bits Encode::BEGIN XML::SAX::ParserFactory::BEGIN XML::SAX::PurePerl::Reader::URI::BEGIN File::Temp::BEGIN XML::Simple::start_element XML::Simple::XMLin XML::SAX::PurePerl::Name XML::SAX::PurePerl::CharData
Just looking at the XML function calls produces this list:
XML::SAX::PurePerl::Reader::URI::new XML::SAX::PurePerl::BEGIN XML::Simple::find_xml_file XML::SAX::PurePerl::Productions::BEGIN XML::SAX::ParserFactory::BEGIN XML::SAX::PurePerl::Reader::URI::BEGIN XML::Simple::start_element XML::Simple::XMLin XML::SAX::PurePerl::Name XML::SAX::PurePerl::CharData
This is what I don't understand... why are there some function calls being performed on some OSes but not on others? Or are some irrelevant enough that they are simply not being listed?

on Linux_x86_64
XML::SAX::PurePerl::BEGIN XML::SAX::Base::get_feature XML::SAX::ParserFactory::_parser_class XML::SAX::BEGIN XML::SAX::ParserFactory::BEGIN XML::SAX::PurePerl::Reader::BEGIN XML::SAX::PurePerl::Reader::URI::BEGIN XML::SAX::PurePerl::doctypedecl

on Solaris 10
XML::SAX::PurePerl::BEGIN XML::SAX::PurePerl::skip_whitespace XML::SAX::PurePerl::Reader::data XML::Simple::start_element XML::SAX::PurePerl::Reader::Stream::move_along XML::SAX::PurePerl::element XML::SAX::PurePerl::Productions::BEGIN XML::Simple::BEGIN XML::SAX::ParserFactory::BEGIN XML::SAX::PurePerl::Reader::BEGIN XML::SAX::PurePerl::Reader::URI::BEGIN
I would have thought the output of DProf on the XML::Simple module would be identical on each OS. Why is this not so?

Can someone enlighten me please?


Replies are listed 'Best First'.
Re: DProf output of named functions.
by kyle (Abbot) on Sep 25, 2007 at 13:54 UTC

    why are there some function calls being performed on some OSes but not on others? Or are some irrelevant enough that they are simply not being listed?

    It's the latter. By default dprofpp will list only the top 15 function calls.

    I normally wouldn't expect profiling results to be exactly the same across architectures for several reasons.

    1. Profiling results can vary from run to run as it is.
    2. The timings are based on user+system time. User time is the time spent in your code and system time is the time spent in the OS serving your code. When you open and read a file, for instance, the OS is doing that work, and the time it spends doing that counts as system time. Each OS might spend different amounts of time on the same calls based on differences between them.
    3. Each OS may have its own limits on how well it can measure time at all (i.e., precision, granularity). Compounded measurement errors could be skewing results.
    4. Without seeing the code, I don't know, but it's possible that there is some branching according to OS. I don't know why that would be the case for you, but it's certainly possible in general.
      5. Underlying compilers, libraries, instruction sets, and hardware.
Re: DProf output of named functions.
by perrin (Chancellor) on Sep 25, 2007 at 13:42 UTC
    You probably have different versions of DProf and Perl on these machines.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://640916]
Approved by Corion
Front-paged by Corion
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2023-12-06 14:18 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (30 votes). Check out past polls.