|
From: <sv...@va...> - 2006-08-31 22:54:40
|
Author: weidendo
Date: 2006-08-31 23:54:36 +0100 (Thu, 31 Aug 2006)
New Revision: 6044
Log:
Callgrind: Fix annotate script for data produced with --dump-instr=3Dyes
I just noticed that this is still a little wrong, as counts for e.g.
"strcmp" from libc and "strcmp" from ld.so will make up only one entry,
with the object name randomly choosen... but otherwise, it matches
with the data shown by KCachegrind.
Modified:
trunk/callgrind/callgrind_annotate.in
Modified: trunk/callgrind/callgrind_annotate.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/callgrind/callgrind_annotate.in 2006-08-31 19:29:13 UTC (rev 60=
43)
+++ trunk/callgrind/callgrind_annotate.in 2006-08-31 22:54:36 UTC (rev 60=
44)
@@ -483,6 +483,7 @@
my $curr_fn;
my $curr_name;
my $curr_line_num =3D 0;
+ my $prev_line_num =3D 0;
=20
my $curr_cobj =3D "";
my $curr_cfile =3D "";
@@ -496,17 +497,19 @@
=20
# Read body of input file.
while (<INPUTFILE>) {
+ $prev_line_num =3D $curr_line_num;
+
s/#.*$//; # remove comments
- s/^\+(\d+)/$curr_line_num+$1/e;
- s/^\-(\d+)/$curr_line_num-$1/e;
- s/^\*/$curr_line_num/e;
- if (s/^(\d+|0x\w+)\s+//) {
+ s/^\+(\d+)/$prev_line_num+$1/e;
+ s/^\-(\d+)/$prev_line_num-$1/e;
+ s/^\*/$prev_line_num/e;
+ if (s/^(-?\d+|0x\w+)\s+//) {
$curr_line_num =3D $1;
if ($has_addr) {
if ($has_line) {
- s/^\+(\d+)/$curr_line_num+$1/e;
- s/^\-(\d+)/$curr_line_num-$1/e;
- s/^\*/$curr_line_num/e;
+ s/^\+(\d+)/$prev_line_num+$1/e;
+ s/^\-(\d+)/$prev_line_num-$1/e;
+ s/^\*/$prev_line_num/e;
=20
if (s/^(\d+)\s+//) { $curr_line_num =3D $1; }
}
|