http://qs321.pair.com?node_id=11114182


in reply to Re^3: NYTProf line report failure
in thread NYTProf line report failure

Thank you for the suggested patch. The change to line 430 of Devel::NYTProf::FileInfo has restored functionality to nytprofhtml with some warnings about uninitialized values. I treasure your wild guesses.

What is $self->profile and what could cause it to be undef? Is it the result of profiling a statement, or a subroutine? What do you think my usage of is seriously wrong, Perl or NYTProf? I have no problem with the module that's being profiled, or scripts that use it, or with commandline usage. I'm not doing anything unusual with NYTProf either.

Here are those warnings:

Writing line reports to nytprof directory 97% ... Use of uninitialized value in numeric gt (>) at /Devel/NYTPr +of/Reader.pm line 184. Use of uninitialized value in numeric gt (>) at /Devel/NYTProf/Reader. +pm line 185. Use of uninitialized value $fname in substitution (s///) at /Devel/NYT +Prof/Util.pm line 235. Use of uninitialized value $fname in substitution (s///) at /Devel/NYT +Prof/Util.pm line 237. Use of uninitialized value $fname in substitution (s///) at /Devel/NYT +Prof/Util.pm line 238. Use of uninitialized value in concatenation (.) or string at /Devel/NY +TProf/Reader.pm line 188. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 540. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 541. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 542. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 543. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 544. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 545. Use of uninitialized value in sprintf at /bin/nytprofhtml line 202. 98% ... Use of uninitialized value in numeric gt (>) at /Devel/NYTPr +of/Reader.pm line 184. Use of uninitialized value in numeric gt (>) at /Devel/NYTProf/Reader. +pm line 185. Use of uninitialized value $fname in substitution (s///) at /Devel/NYT +Prof/Util.pm line 235. Use of uninitialized value $fname in substitution (s///) at /Devel/NYT +Prof/Util.pm line 237. Use of uninitialized value $fname in substitution (s///) at /Devel/NYT +Prof/Util.pm line 238. Use of uninitialized value in concatenation (.) or string at /Devel/NY +TProf/Reader.pm line 188. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 540. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 541. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 542. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 543. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 544. Use of uninitialized value $_ in substitution (s///) at /bin/nytprofht +ml line 545. Use of uninitialized value in sprintf at /bin/nytprofhtml line 202. 100% ... Extracting subroutine call data (There were 9159849 of them, so this m +ay take some time, or cancel and use --no-flame to skip this step.) . +.. Extracting subroutine links Generating subroutine stack flame graph ...

Replies are listed 'Best First'.
Re^5: NYTProf line report failure
by bliako (Monsignor) on Mar 12, 2020 at 21:01 UTC

    I said that you must be using NYTProf completely wrong because I don't think a module like this can break so spectacularly. Again, a wild guess :)

    What is the commandline you used, or are you using NYTProf via Apache (i.e. How to use Devel::NYTProf on Apache)? Does NYTProf work without these problems on a different file?

    For the particular log you provided, line 175 of /Devel/NYTProf/Reader.pm sets my $fname = $fi->filename_without_inc; and most of the complaints you see are saying that $fname is undefined. Why is that? Well it has something to do with that ->inc I guess again, because $fi->filename_without_inc must be somehow related? So there is no filename, there is no profile!

    I propose that you restore NYTProf to its previous state (remove what I provided) and then if you want to debug, you must slowly work your way inside nytprofhtml and the modules it's using, inserting a print statement here or there. But first let's double check that the commandline is correct and that no ENV var is messing things up. Also make sure that NYTProf is properly installed by profiling a simple script and checking you get valid output.

      I use NYTProf often enough to have aliases set to maximize laziness:
      alias profile='perl -d:NYTProf'
      alias profileh='nytprofhtml --open'
      
      That's been working for a very long time. I don't know how to use NYTProf wrong. It works well for me except for this one big module that does things which would cause modern PerlMonks to hide their children, but under strict conditions with no warnings, so I don't see why it upsets NYTProf.

      I'm happy with the hack that gets me a report because I like to browse code as a website. Seeing it outside the comfort of my editor provides a different perspective. Maybe this thread will be useful to whoever adopts NYTProf and tries to improve filename handling of the profiler. Thanks for guessing :)

        I guess you cannot share the code, but maybe noting some of the, possibly egregious, coding practices it contains would help reproduce the problem?