timbunce / devel-nytprof

Devel::NYTProf is a powerful feature-rich source code profiler for Perl. (Mostly in maintenance mode, so PRs are much more likely to be acted upon than Issues.)
http://blog.timbunce.org/tag/nytprof/
67 stars 51 forks source link

nytprofhtml try to hook SIGUSR2 on MSWin32 + divide by zero #78

Closed xlat closed 8 years ago

xlat commented 9 years ago

Hi, I was testing Mojolicious::Plugin::NYTProf v0.14 on strawberyperl 5.20.1.1 x64, and I've just found those 2 errors in Devel::NYTProf v6.02:

First is that nytprofhtml die because of $SIG{USR2} hooks that does not exists on mswin32, and nytprofpf throws a warning because it is surrounded by an eval{ }.

Second is that nytprofhtml encoutered divide by zero in this code block:

# bin/nytprofhtml at line 1023
        my $total_time = $si->profile->{attribute}{profiler_duration};
        my $incl_time = $si->incl_time;
        push @html, sprintf "Inclusive time: %s, %.2f%%",
                fmt_time($incl_time), $incl_time/$total_time*100;
        my $excl_time = $si->excl_time;
        push @html, sprintf "Exclusive time: %s, %.2f%%",
                fmt_time($excl_time), $excl_time/$total_time*100
            if $excl_time ne $incl_time;