/
perftools-pprof.patch
59 lines (54 loc) · 1.83 KB
/
perftools-pprof.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/src/pprof b/src/pprof
index e67e42e..ee9927c 100755
--- a/src/pprof
+++ b/src/pprof
@@ -560,7 +560,8 @@ sub Main() {
my $symbol_map = {};
# Read one profile, pick the last item on the list
- my $data = ReadProfile($main::prog, pop(@main::profile_files));
+ my $fname = pop(@main::profile_files);
+ my $data = ReadProfile($main::prog, $fname);
my $profile = $data->{profile};
my $pcs = $data->{pcs};
my $libs = $data->{libs}; # Info about main program and shared libraries
@@ -601,6 +602,17 @@ sub Main() {
$symbols = ExtractSymbols($libs, $pcs);
}
+ if (-e "$fname.symbols") {
+ open(SYMBOLS, "<$fname.symbols");
+ while(<SYMBOLS>){
+ chop;
+ if (m/(.+?)\s*:\s*(.*)/){
+ $symbols->{$1}[0] = $2;
+ }
+ }
+ close(SYMBOLS);
+ }
+
# Remove uniniteresting stack items
$profile = RemoveUninterestingFrames($symbols, $profile);
@@ -2425,6 +2437,10 @@ sub RemoveUninterestingFrames {
foreach my $name ('ProfileData::Add', # historical
'ProfileData::prof_handler', # historical
'CpuProfiler::prof_handler',
+ 'PerfTools::CpuProfiler.start',
+ 'Array#each',
+ 'Proc#call',
+ 'Class#new',
'__FRAME_END__',
'__pthread_sighandler',
'__restore') {
@@ -2434,6 +2450,7 @@ sub RemoveUninterestingFrames {
# Nothing skipped for unknown types
}
+=pod
if ($main::profile_type eq 'cpu') {
# If all the second-youngest program counters are the same,
# this STRONGLY suggests that it is an artifact of measurement,
@@ -2458,6 +2475,7 @@ sub RemoveUninterestingFrames {
$profile = $result;
}
}
+=cut
my $result = {};
foreach my $k (keys(%{$profile})) {