How can I use NYTProf in the library

I am wondering if Devel :: NYTProf can be used as a library in another library. I would like to do something like the following

around 'somesub' => sub {
    my $orig = shift;
    my $self = shift;
    start-timing;
    $self->$orig(@_);
    end-timing;
    print '$time';
}

but from it the documentation I can’t determine if it can be used like that. Is it possible? can someone tell me the API calls that I would make?

+3
source share
2 answers

The simplest and most reliable thing:

  • Add DB::enable_profileand DB::disable_profilecall your library (you can check if the subsites are determined to avoid breakage when NYTProf not loaded).
  • perl -d: NYTProf NYTPROF=start=no .

Devel:: NYTProf docs.

, NYTProf, , , NYTProf, . , , , , ( ) , . , make:)

+4

Source: https://habr.com/ru/post/1757372/


All Articles