mcst-linux-kernel/patches-2024.06.26/gperftools-2.10/0004-Add-patches-for-pprof-...

61 lines
1.9 KiB
Diff

Link:
Subject: Add patches for pprof from jeprof
Bug: 146136
diff -Naur a/src/pprof b/src/pprof
--- a/src/pprof 2023-07-07 12:41:54.332737201 +0000
+++ b/src/pprof 2023-07-07 12:47:23.414442095 +0000
@@ -93,7 +93,7 @@
my @DOT = ("dot"); # leave non-absolute, since it may be in /usr/local
my @GV = ("gv");
my @EVINCE = ("evince"); # could also be xpdf or perhaps acroread
-my @KCACHEGRIND = ("kcachegrind");
+my @KCACHEGRIND = ("qcachegrind");
my @PS2PDF = ("ps2pdf");
# These are used for dynamic profiles
my @URL_FETCHER = ("curl", "-s");
@@ -1379,10 +1379,11 @@
my $filename = "";
my $linenumber = -1;
my $last = ["", "", "", ""];
+ my $in_instr = 0;
while (<OBJDUMP>) {
s/\r//g; # turn windows-looking lines into unix-looking lines
chop;
- if (m|\s*([^:\s]+):(\d+)\s*$|) {
+ if (m|^\s*([^:\s]+):(\d+)\s*$|) {
# Location line of the form:
# <filename>:<linenumber>
$filename = $1;
@@ -1394,7 +1395,11 @@
$last->[4] = $k; # Store ending address for previous instruction
$last = [$k, $filename, $linenumber, $2, $end_addr];
push(@result, $last);
- }
+ $in_instr=1;
+ } elsif (m/^\s+(\S.*)$/ && ($in_instr < 30)) { #MCST save up to 30 non-empty lines
+ $in_instr++;
+ $last->[3] .= "\n\t\t\t\t$1";
+ }
}
close(OBJDUMP);
return @result;
@@ -2019,7 +2024,7 @@
} else {
$line =~ s/^\s+//;
}
- printf("%6s %6s %5d: %s",
+ printf("Source: %6s %6s %5d: %s",
UnparseAlt($flat_sum{$l}),
UnparseAlt($cum_sum{$l}),
$l,
@@ -2973,6 +2978,8 @@
'pvalloc',
'valloc',
'realloc',
+ '__libc_malloc',
+ '__libc_free',
'tc_calloc',
'tc_cfree',
'tc_malloc',