Devel::NYTProf::Callgrind::TicksDiff - Calculates a delta between 2 callgrind files
The command line way:
# Output to STDOUT callgrind diff fileA.callgrind fileB.callgrind # Output to a file callgrind diff fileA.callgrind fileB.callgrind --out callgrind # With normalization (see below) callgrind diff fileA.callgrind fileB.callgrind --out callgrind --normalize
The Perl way:
use Devel::NYTProf::Callgrind::TicksDiff; my $tickdiff = Devel::NYTProf::Callgrind::TicksDiff->new( files => [$fileA,$fileB], normalize => 1 ); print $ticksdiff->getDiffText();
If you do a performance analysis with NYTProf over different computers and want to know what makes the application slower on the second machine, it might be usefull to see the difference.
TicksDiff takes the callgrind files, you can get with nytprofcg and calculates the delta between 2 files to a new callgrind file.
It is nice to open the resulting file with kcachegrind to see it in a graphical way.
Devel::NYTProf::Callgrind::TicksDiff
Moose
Devel::NYTProf::Callgrind::Ticks
my \%hashref = $this->compare();
starts the compare process. So far it compares only two files. Returning infos in a hash.
my $ticks = $this->diffBlocks(\%blockA, \%blockB);
Compares two single blocks (HasRefs) provided by the Ticks class of this package. It returns the tick difference between B and A. Means B-Ticks - A-Ticks.
my $Object = $this->getDeltaTicksObject();
just a wrapper around ticks_object_out
my $text = $this->getDiffText();
Returns the callgrind text of the diff.
$this->saveDiffFile($filename);
Saves the difference to a callgrind file
You can redistribute it and/or modify it under the conditions of LGPL and Artistic Licence.
The comand line and the contructor can take the argument 'normalize'. It will avoid to truncate negative values.
To understand it, ive got to explain what happens in TicksDiff: If you have to runs of a perl script (Run A and B) with different amount of ticks.
A B function 100 120 foo() 120 100 bar()
And you make a diff of it, TicksDiff would assume, you want to know how many ticks MORE the run B needs than A. The result would be:
A B diff function 100 120 20 foo() 120 100 0 bar() # -20 is the real diff
The negative values will ne truncated to 0 because it is not possible to have negative ticks (maybe in a black whole ;-)
If you dont want that truncation, you can raise the whole level with the biggest negative value. So the result would be:
A B normalized diff function 100 120 40 foo() 120 100 0 bar()
Andreas Hernitscheck - ahernit AT cpan.org
To install Devel::NYTProf::Callgrind::TicksDiff, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::NYTProf::Callgrind::TicksDiff
CPAN shell
perl -MCPAN -e shell install Devel::NYTProf::Callgrind::TicksDiff
For more information on module installation, please visit the detailed CPAN module installation guide.