40
40
#
41
41
# Examples:
42
42
#
43
- # % tools/pprof "program" "profile"
43
+ # % tools/jeprof "program" "profile"
44
44
# Enters "interactive" mode
45
45
#
46
- # % tools/pprof --text "program" "profile"
46
+ # % tools/jeprof --text "program" "profile"
47
47
# Generates one line per procedure
48
48
#
49
- # % tools/pprof --gv "program" "profile"
49
+ # % tools/jeprof --gv "program" "profile"
50
50
# Generates annotated call-graph and displays via "gv"
51
51
#
52
- # % tools/pprof --gv --focus=Mutex "program" "profile"
52
+ # % tools/jeprof --gv --focus=Mutex "program" "profile"
53
53
# Restrict to code paths that involve an entry that matches "Mutex"
54
54
#
55
- # % tools/pprof --gv --focus=Mutex --ignore=string "program" "profile"
55
+ # % tools/jeprof --gv --focus=Mutex --ignore=string "program" "profile"
56
56
# Restrict to code paths that involve an entry that matches "Mutex"
57
57
# and does not match "string"
58
58
#
59
- # % tools/pprof --list=IBF_CheckDocid "program" "profile"
59
+ # % tools/jeprof --list=IBF_CheckDocid "program" "profile"
60
60
# Generates disassembly listing of all routines with at least one
61
61
# sample that match the --list=<regexp> pattern. The listing is
62
62
# annotated with the flat and cumulative sample counts at each line.
63
63
#
64
- # % tools/pprof --disasm=IBF_CheckDocid "program" "profile"
64
+ # % tools/jeprof --disasm=IBF_CheckDocid "program" "profile"
65
65
# Generates disassembly listing of all routines with at least one
66
66
# sample that match the --disasm=<regexp> pattern. The listing is
67
67
# annotated with the flat and cumulative sample counts at each PC value.
@@ -72,10 +72,11 @@ use strict;
72
72
use warnings;
73
73
use Getopt::Long;
74
74
75
+ my $JEPROF_VERSION = " @jemalloc_version @" ;
75
76
my $PPROF_VERSION = " 2.0" ;
76
77
77
78
# These are the object tools we use which can come from a
78
- # user-specified location using --tools, from the PPROF_TOOLS
79
+ # user-specified location using --tools, from the JEPROF_TOOLS
79
80
# environment variable, or from the environment.
80
81
my %obj_tool_map = (
81
82
" objdump" => " objdump" ,
@@ -144,13 +145,13 @@ my $sep_address = undef;
144
145
sub usage_string {
145
146
return <<EOF ;
146
147
Usage:
147
- pprof [options] <program> <profiles>
148
+ jeprof [options] <program> <profiles>
148
149
<profiles> is a space separated list of profile names.
149
- pprof [options] <symbolized-profiles>
150
+ jeprof [options] <symbolized-profiles>
150
151
<symbolized-profiles> is a list of profile files where each file contains
151
152
the necessary symbol mappings as well as profile data (likely generated
152
153
with --raw).
153
- pprof [options] <profile>
154
+ jeprof [options] <profile>
154
155
<profile> is a remote form. Symbols are obtained from host:port$SYMBOL_PAGE
155
156
156
157
Each name can be:
@@ -161,9 +162,9 @@ pprof [options] <profile>
161
162
$GROWTH_PAGE , $CONTENTION_PAGE , /pprof/wall,
162
163
$CENSUSPROFILE_PAGE , or /pprof/filteredprofile.
163
164
For instance:
164
- pprof http://myserver.com:80$HEAP_PAGE
165
+ jeprof http://myserver.com:80$HEAP_PAGE
165
166
If /<service> is omitted, the service defaults to $PROFILE_PAGE (cpu profiling).
166
- pprof --symbols <program>
167
+ jeprof --symbols <program>
167
168
Maps addresses to symbol names. In this mode, stdin should be a
168
169
list of library mappings, in the same format as is found in the heap-
169
170
and cpu-profile files (this loosely matches that of /proc/self/maps
@@ -202,7 +203,7 @@ Output type:
202
203
--pdf Generate PDF to stdout
203
204
--svg Generate SVG to stdout
204
205
--gif Generate GIF to stdout
205
- --raw Generate symbolized pprof data (useful with remote fetch)
206
+ --raw Generate symbolized jeprof data (useful with remote fetch)
206
207
207
208
Heap-Profile Options:
208
209
--inuse_space Display in-use (mega)bytes [default]
@@ -236,42 +237,43 @@ Miscellaneous:
236
237
--version Version information
237
238
238
239
Environment Variables:
239
- PPROF_TMPDIR Profiles directory. Defaults to \$ HOME/pprof
240
- PPROF_TOOLS Prefix for object tools pathnames
240
+ JEPROF_TMPDIR Profiles directory. Defaults to \$ HOME/jeprof
241
+ JEPROF_TOOLS Prefix for object tools pathnames
241
242
242
243
Examples:
243
244
244
- pprof /bin/ls ls.prof
245
+ jeprof /bin/ls ls.prof
245
246
Enters "interactive" mode
246
- pprof --text /bin/ls ls.prof
247
+ jeprof --text /bin/ls ls.prof
247
248
Outputs one line per procedure
248
- pprof --web /bin/ls ls.prof
249
+ jeprof --web /bin/ls ls.prof
249
250
Displays annotated call-graph in web browser
250
- pprof --gv /bin/ls ls.prof
251
+ jeprof --gv /bin/ls ls.prof
251
252
Displays annotated call-graph via 'gv'
252
- pprof --gv --focus=Mutex /bin/ls ls.prof
253
+ jeprof --gv --focus=Mutex /bin/ls ls.prof
253
254
Restricts to code paths including a .*Mutex.* entry
254
- pprof --gv --focus=Mutex --ignore=string /bin/ls ls.prof
255
+ jeprof --gv --focus=Mutex --ignore=string /bin/ls ls.prof
255
256
Code paths including Mutex but not string
256
- pprof --list=getdir /bin/ls ls.prof
257
+ jeprof --list=getdir /bin/ls ls.prof
257
258
(Per-line) annotated source listing for getdir()
258
- pprof --disasm=getdir /bin/ls ls.prof
259
+ jeprof --disasm=getdir /bin/ls ls.prof
259
260
(Per-PC) annotated disassembly for getdir()
260
261
261
- pprof http://localhost:1234/
262
+ jeprof http://localhost:1234/
262
263
Enters "interactive" mode
263
- pprof --text localhost:1234
264
+ jeprof --text localhost:1234
264
265
Outputs one line per procedure for localhost:1234
265
- pprof --raw localhost:1234 > ./local.raw
266
- pprof --text ./local.raw
266
+ jeprof --raw localhost:1234 > ./local.raw
267
+ jeprof --text ./local.raw
267
268
Fetches a remote profile for later analysis and then
268
269
analyzes it in text mode.
269
270
EOF
270
271
}
271
272
272
273
sub version_string {
273
274
return <<EOF
274
- pprof (part of gperftools $PPROF_VERSION )
275
+ jeprof (part of jemalloc $JEPROF_VERSION )
276
+ based on pprof (part of gperftools $PPROF_VERSION )
275
277
276
278
Copyright 1998-2007 Google Inc.
277
279
@@ -294,8 +296,8 @@ sub Init() {
294
296
# Setup tmp-file name and handler to clean it up.
295
297
# We do this in the very beginning so that we can use
296
298
# error() and cleanup() function anytime here after.
297
- $main::tmpfile_sym = " /tmp/pprof $$ .sym" ;
298
- $main::tmpfile_ps = " /tmp/pprof $$ " ;
299
+ $main::tmpfile_sym = " /tmp/jeprof $$ .sym" ;
300
+ $main::tmpfile_ps = " /tmp/jeprof $$ " ;
299
301
$main::next_tmpfile = 0;
300
302
$SIG {' INT' } = \&sighandler;
301
303
@@ -802,22 +804,22 @@ sub InteractiveMode {
802
804
$| = 1; # Make output unbuffered for interactive mode
803
805
my ($orig_profile , $symbols , $libs , $total ) = @_ ;
804
806
805
- print STDERR " Welcome to pprof ! For help, type 'help'.\n " ;
807
+ print STDERR " Welcome to jeprof ! For help, type 'help'.\n " ;
806
808
807
809
# Use ReadLine if it's installed and input comes from a console.
808
810
if ( -t STDIN &&
809
811
!ReadlineMightFail() &&
810
812
defined (eval {require Term::ReadLine}) ) {
811
- my $term = new Term::ReadLine ' pprof ' ;
812
- while ( defined ($_ = $term -> readline(' (pprof ) ' ))) {
813
+ my $term = new Term::ReadLine ' jeprof ' ;
814
+ while ( defined ($_ = $term -> readline(' (jeprof ) ' ))) {
813
815
$term -> addhistory($_ ) if / \S / ;
814
816
if (!InteractiveCommand($orig_profile , $symbols , $libs , $total , $_ )) {
815
817
last ; # exit when we get an interactive command to quit
816
818
}
817
819
}
818
820
} else { # don't have readline
819
821
while (1) {
820
- print STDERR " (pprof ) " ;
822
+ print STDERR " (jeprof ) " ;
821
823
$_ = <STDIN >;
822
824
last if ! defined $_ ;
823
825
s /\r // g ; # turn windows-looking lines into unix-looking lines
@@ -1010,7 +1012,7 @@ sub ProcessProfile {
1010
1012
1011
1013
sub InteractiveHelpMessage {
1012
1014
print STDERR <<ENDOFHELP ;
1013
- Interactive pprof mode
1015
+ Interactive jeprof mode
1014
1016
1015
1017
Commands:
1016
1018
gv
@@ -1053,7 +1055,7 @@ Commands:
1053
1055
Generates callgrind file. If no filename is given, kcachegrind is called.
1054
1056
1055
1057
help - This listing
1056
- quit or ^D - End pprof
1058
+ quit or ^D - End jeprof
1057
1059
1058
1060
For commands that accept optional -ignore tags, samples where any routine in
1059
1061
the stack trace matches the regular expression in any of the -ignore
@@ -1498,7 +1500,7 @@ h1 {
1498
1500
}
1499
1501
</style>
1500
1502
<script type="text/javascript">
1501
- function pprof_toggle_asm (e) {
1503
+ function jeprof_toggle_asm (e) {
1502
1504
var target;
1503
1505
if (!e) e = window.event;
1504
1506
if (e.target) target = e.target;
@@ -1767,7 +1769,7 @@ sub PrintSource {
1767
1769
1768
1770
if ($html ) {
1769
1771
printf $output (
1770
- " <h1>%s </h1>%s \n <pre onClick=\" pprof_toggle_asm ()\" >\n " .
1772
+ " <h1>%s </h1>%s \n <pre onClick=\" jeprof_toggle_asm ()\" >\n " .
1771
1773
" Total:%6s %6s (flat / cumulative %s )\n " ,
1772
1774
HtmlEscape(ShortFunctionName($routine )),
1773
1775
HtmlEscape(CleanFileName($filename )),
@@ -3433,7 +3435,7 @@ sub FetchDynamicProfile {
3433
3435
$profile_file .= $suffix ;
3434
3436
}
3435
3437
3436
- my $profile_dir = $ENV {" PPROF_TMPDIR " } || ($ENV {HOME } . " /pprof " );
3438
+ my $profile_dir = $ENV {" JEPROF_TMPDIR " } || ($ENV {HOME } . " /jeprof " );
3437
3439
if (! -d $profile_dir ) {
3438
3440
mkdir ($profile_dir )
3439
3441
|| die (" Unable to create profile directory $profile_dir : $! \n " );
@@ -3649,7 +3651,7 @@ BEGIN {
3649
3651
# Reads the top, 'header' section of a profile, and returns the last
3650
3652
# line of the header, commonly called a 'header line'. The header
3651
3653
# section of a profile consists of zero or more 'command' lines that
3652
- # are instructions to pprof , which pprof executes when reading the
3654
+ # are instructions to jeprof , which jeprof executes when reading the
3653
3655
# header. All 'command' lines start with a %. After the command
3654
3656
# lines is the 'header line', which is a profile-specific line that
3655
3657
# indicates what type of profile it is, and perhaps other global
@@ -4256,10 +4258,10 @@ sub ReadSynchProfile {
4256
4258
} elsif ($variable eq " sampling period" ) {
4257
4259
$sampling_period = $value ;
4258
4260
} elsif ($variable eq " ms since reset" ) {
4259
- # Currently nothing is done with this value in pprof
4261
+ # Currently nothing is done with this value in jeprof
4260
4262
# So we just silently ignore it for now
4261
4263
} elsif ($variable eq " discarded samples" ) {
4262
- # Currently nothing is done with this value in pprof
4264
+ # Currently nothing is done with this value in jeprof
4263
4265
# So we just silently ignore it for now
4264
4266
} else {
4265
4267
printf STDERR (" Ignoring unnknown variable in /contention output: " .
@@ -4565,7 +4567,7 @@ sub ParseLibraries {
4565
4567
}
4566
4568
4567
4569
# Add two hex addresses of length $address_length.
4568
- # Run pprof --test for unit test if this is changed.
4570
+ # Run jeprof --test for unit test if this is changed.
4569
4571
sub AddressAdd {
4570
4572
my $addr1 = shift ;
4571
4573
my $addr2 = shift ;
@@ -4619,7 +4621,7 @@ sub AddressAdd {
4619
4621
4620
4622
4621
4623
# Subtract two hex addresses of length $address_length.
4622
- # Run pprof --test for unit test if this is changed.
4624
+ # Run jeprof --test for unit test if this is changed.
4623
4625
sub AddressSub {
4624
4626
my $addr1 = shift ;
4625
4627
my $addr2 = shift ;
@@ -4671,7 +4673,7 @@ sub AddressSub {
4671
4673
}
4672
4674
4673
4675
# Increment a hex addresses of length $address_length.
4674
- # Run pprof --test for unit test if this is changed.
4676
+ # Run jeprof --test for unit test if this is changed.
4675
4677
sub AddressInc {
4676
4678
my $addr = shift ;
4677
4679
my $sum ;
@@ -4989,7 +4991,7 @@ sub UnparseAddress {
4989
4991
# 32-bit or ELF 64-bit executable file. The location of the tools
4990
4992
# is determined by considering the following options in this order:
4991
4993
# 1) --tools option, if set
4992
- # 2) PPROF_TOOLS environment variable, if set
4994
+ # 2) JEPROF_TOOLS environment variable, if set
4993
4995
# 3) the environment
4994
4996
sub ConfigureObjTools {
4995
4997
my $prog_file = shift ;
@@ -5022,7 +5024,7 @@ sub ConfigureObjTools {
5022
5024
# For windows, we provide a version of nm and addr2line as part of
5023
5025
# the opensource release, which is capable of parsing
5024
5026
# Windows-style PDB executables. It should live in the path, or
5025
- # in the same directory as pprof .
5027
+ # in the same directory as jeprof .
5026
5028
$obj_tool_map {" nm_pdb" } = " nm-pdb" ;
5027
5029
$obj_tool_map {" addr2line_pdb" } = " addr2line-pdb" ;
5028
5030
}
@@ -5041,20 +5043,20 @@ sub ConfigureObjTools {
5041
5043
}
5042
5044
5043
5045
# Returns the path of a caller-specified object tool. If --tools or
5044
- # PPROF_TOOLS are specified, then returns the full path to the tool
5046
+ # JEPROF_TOOLS are specified, then returns the full path to the tool
5045
5047
# with that prefix. Otherwise, returns the path unmodified (which
5046
5048
# means we will look for it on PATH).
5047
5049
sub ConfigureTool {
5048
5050
my $tool = shift ;
5049
5051
my $path ;
5050
5052
5051
- # --tools (or $PPROF_TOOLS ) is a comma separated list, where each
5053
+ # --tools (or $JEPROF_TOOLS ) is a comma separated list, where each
5052
5054
# item is either a) a pathname prefix, or b) a map of the form
5053
5055
# <tool>:<path>. First we look for an entry of type (b) for our
5054
5056
# tool. If one is found, we use it. Otherwise, we consider all the
5055
5057
# pathname prefixes in turn, until one yields an existing file. If
5056
5058
# none does, we use a default path.
5057
- my $tools = $main::opt_tools || $ENV {" PPROF_TOOLS " } || " " ;
5059
+ my $tools = $main::opt_tools || $ENV {" JEPROF_TOOLS " } || " " ;
5058
5060
if ($tools =~ m / (,|^)\Q $tool \E :([^,]*)/ ) {
5059
5061
$path = $2 ;
5060
5062
# TODO(csilvers): sanity-check that $path exists? Hard if it's relative.
@@ -5068,11 +5070,11 @@ sub ConfigureTool {
5068
5070
}
5069
5071
if (!$path ) {
5070
5072
error(" No '$tool ' found with prefix specified by " .
5071
- " --tools (or \$ PPROF_TOOLS ) '$tools '\n " );
5073
+ " --tools (or \$ JEPROF_TOOLS ) '$tools '\n " );
5072
5074
}
5073
5075
} else {
5074
5076
# ... otherwise use the version that exists in the same directory as
5075
- # pprof . If there's nothing there, use $PATH.
5077
+ # jeprof . If there's nothing there, use $PATH.
5076
5078
$0 =~ m ,[^/] *$ , ; # this is everything after the last slash
5077
5079
my $dirname = $` ; # this is everything up to and including the last slash
5078
5080
if (-x " $dirname$tool " ) {
@@ -5102,7 +5104,7 @@ sub cleanup {
5102
5104
unlink ($main::tmpfile_sym );
5103
5105
unlink (keys %main::tempnames );
5104
5106
5105
- # We leave any collected profiles in $HOME/pprof in case the user wants
5107
+ # We leave any collected profiles in $HOME/jeprof in case the user wants
5106
5108
# to look at them later. We print a message informing them of this.
5107
5109
if ((scalar (@main::profile_files ) > 0) &&
5108
5110
defined ($main::collected_profile )) {
@@ -5111,7 +5113,7 @@ sub cleanup {
5111
5113
}
5112
5114
print STDERR " If you want to investigate this profile further, you can do:\n " ;
5113
5115
print STDERR " \n " ;
5114
- print STDERR " pprof \\\n " ;
5116
+ print STDERR " jeprof \\\n " ;
5115
5117
print STDERR " $main::prog \\\n " ;
5116
5118
print STDERR " $main::collected_profile \n " ;
5117
5119
print STDERR " \n " ;
@@ -5296,7 +5298,7 @@ sub GetProcedureBoundaries {
5296
5298
# The test vectors for AddressAdd/Sub/Inc are 8-16-nibble hex strings.
5297
5299
# To make them more readable, we add underscores at interesting places.
5298
5300
# This routine removes the underscores, producing the canonical representation
5299
- # used by pprof to represent addresses, particularly in the tested routines.
5301
+ # used by jeprof to represent addresses, particularly in the tested routines.
5300
5302
sub CanonicalHex {
5301
5303
my $arg = shift ;
5302
5304
return join ' ' , (split ' _' ,$arg );
0 commit comments