1. Perl
  2. Module
  3. here

Devel::NYTProf - Easy - to - read profiler

Devel::NYTProf is a tool to find out which process in your program is taking a long time. Such a tool is called a profiler. It is very easy to see because it converts the analysis result into an HTML file.

Creating a profile is easy. When the following command is executed, a file that outputs the profile information "nytprof.out" is created in the current directory.

# Create profile information
perl -d: NYTProf target.pl

To convert "nytprof.out" to an HTML file, run the nytprof html command.

# Convert profile information to HTML file
nytprofhtml

An HTML file will be created in the "nytprof /" directory of the current directory. You can see the profile information by opening "nytprof/index.html".

[f: id: perlcodeexample: 20100612223218p: image]

The above result is the result in my environment when I run the script.

use strict;
use warnings;

func1 ();
func2 ();
func2 ();

sub func1 {
  my $i = 0;
  while ($i < 1000000) {
    $i++;
  }
}

sub func2 {
  my $i = 0;
  while ($i < 2000000) {
    $i++;
  }
}

The number is incremented using while statement.

Related Informatrion