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

Dear Monks,

I have been doing a lot of profiling lately and Devel::NYTProf has been great. But you improve code in one area and you just move the bottleneck to somewhere else.

If you look at this result, I'm interested in just looking at code that takes seconds.

Calls P F Exclusive Time Inclusive 100000 1 1 577s 1067s 1 1 1 22µs 22µs

So is there a way to tell Devel::NYTProf that I want seconds abbreviated as 'sec' or 'Sec' instead of 's'? Makes searching a lot easier.

Thank you

"Well done is better than well said." - Benjamin Franklin

Replies are listed 'Best First'.
Re: Can the html output format of Devel::NYTProf be changed?
by stonecolddevin (Parson) on Mar 30, 2012 at 18:58 UTC

    I'm almost positive you can click on the column headers and sort by the categories, ie, "Exclusive Time" or "Inclusive"

    Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

Re: Can the html output format of Devel::NYTProf be changed?
by petdance (Parson) on Mar 30, 2012 at 20:23 UTC
    But you improve code in one area and you just move the bottleneck to somewhere else.

    That's right. That's how it works. Some parts of the code will take more time than others. It's just the way programs are.

    For me, the game of "hammer down this slow part and highlight another" is an enjoyable game.

    xoxo,
    Andy

Re: Can the html output format of Devel::NYTProf be changed?
by BrowserUk (Patriarch) on Mar 30, 2012 at 21:22 UTC

    I think that these few lines (from sub get_html_header() in file: Devel-NYTProf-4.06/bin/nytprofhtml may be where the change would need to be applied. I can't be sure because I believe the code in question is javascript, and I've done very little of that and what I did do, was a long time since:

    format: function(orig) { // format data for normalization // console.log(orig); val = orig.replace(/ns/,''); if (val != orig) { return val / (1000*1000*1000); } val = orig.replace(/µs/,''); /* XXX use &micro; ? */ if (val != orig) { return val / (1000*1000); } var val = orig.replace(/ms/,''); if (val != orig) { return val / (1000); } var val = orig.replace(/s/,''); ######## <<<<<<<<<<<<<< if (val != orig) { return val; } if (orig == '0') { return orig; } console.log('no match for fmt_time of '.concat(orig)); return orig; },

    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?

      BrowserUk,

      I did look at that javascript code in the html output, but it didn't seem to be called. But because you mentioned 'nytprofhtml', I looked at the code expecting it to be compiled like NYTProf.so, but it was a pure Perl script.

      In the script they did a 'use Devel::NYTProf::Util' which had a sub 'fmt_time'. It had a series of 'sprintf's and I made the change there. Now the output has 'Sec' instead of 's'. While I was at it, I added some bold to the lines to make it a little easier on my eyes.

      Devel::NYTProf is awesome!

      Thank you

      "Well done is better than well said." - Benjamin Franklin