Implement --retain and --exclude in jeprof.
These options make it possible to filter symbolized backtrace frames using regular expressions.
This commit is contained in:
parent
3a92319ddc
commit
43de1b3ebc
@ -223,12 +223,14 @@ Call-graph Options:
|
|||||||
--nodefraction=<f> Hide nodes below <f>*total [default=.005]
|
--nodefraction=<f> Hide nodes below <f>*total [default=.005]
|
||||||
--edgefraction=<f> Hide edges below <f>*total [default=.001]
|
--edgefraction=<f> Hide edges below <f>*total [default=.001]
|
||||||
--maxdegree=<n> Max incoming/outgoing edges per node [default=8]
|
--maxdegree=<n> Max incoming/outgoing edges per node [default=8]
|
||||||
--focus=<regexp> Focus on nodes matching <regexp>
|
--focus=<regexp> Focus on backtraces with nodes matching <regexp>
|
||||||
--thread=<n> Show profile for thread <n>
|
--thread=<n> Show profile for thread <n>
|
||||||
--ignore=<regexp> Ignore nodes matching <regexp>
|
--ignore=<regexp> Ignore backtraces with nodes matching <regexp>
|
||||||
--scale=<n> Set GV scaling [default=0]
|
--scale=<n> Set GV scaling [default=0]
|
||||||
--heapcheck Make nodes with non-0 object counts
|
--heapcheck Make nodes with non-0 object counts
|
||||||
(i.e. direct leak generators) more visible
|
(i.e. direct leak generators) more visible
|
||||||
|
--retain=<regexp> Retain only nodes that match <regexp>
|
||||||
|
--exclude=<regexp> Exclude all nodes that match <regexp>
|
||||||
|
|
||||||
Miscellaneous:
|
Miscellaneous:
|
||||||
--tools=<prefix or binary:fullpath>[,...] \$PATH for object tool pathnames
|
--tools=<prefix or binary:fullpath>[,...] \$PATH for object tool pathnames
|
||||||
@ -339,6 +341,8 @@ sub Init() {
|
|||||||
$main::opt_ignore = '';
|
$main::opt_ignore = '';
|
||||||
$main::opt_scale = 0;
|
$main::opt_scale = 0;
|
||||||
$main::opt_heapcheck = 0;
|
$main::opt_heapcheck = 0;
|
||||||
|
$main::opt_retain = '';
|
||||||
|
$main::opt_exclude = '';
|
||||||
$main::opt_seconds = 30;
|
$main::opt_seconds = 30;
|
||||||
$main::opt_lib = "";
|
$main::opt_lib = "";
|
||||||
|
|
||||||
@ -410,6 +414,8 @@ sub Init() {
|
|||||||
"ignore=s" => \$main::opt_ignore,
|
"ignore=s" => \$main::opt_ignore,
|
||||||
"scale=i" => \$main::opt_scale,
|
"scale=i" => \$main::opt_scale,
|
||||||
"heapcheck" => \$main::opt_heapcheck,
|
"heapcheck" => \$main::opt_heapcheck,
|
||||||
|
"retain=s" => \$main::opt_retain,
|
||||||
|
"exclude=s" => \$main::opt_exclude,
|
||||||
"inuse_space!" => \$main::opt_inuse_space,
|
"inuse_space!" => \$main::opt_inuse_space,
|
||||||
"inuse_objects!" => \$main::opt_inuse_objects,
|
"inuse_objects!" => \$main::opt_inuse_objects,
|
||||||
"alloc_space!" => \$main::opt_alloc_space,
|
"alloc_space!" => \$main::opt_alloc_space,
|
||||||
@ -2840,6 +2846,43 @@ sub ExtractCalls {
|
|||||||
return $calls;
|
return $calls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub FilterFrames {
|
||||||
|
my $symbols = shift;
|
||||||
|
my $profile = shift;
|
||||||
|
|
||||||
|
if ($main::opt_retain eq '' && $main::opt_exclude eq '') {
|
||||||
|
return $profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $result = {};
|
||||||
|
foreach my $k (keys(%{$profile})) {
|
||||||
|
my $count = $profile->{$k};
|
||||||
|
my @addrs = split(/\n/, $k);
|
||||||
|
my @path = ();
|
||||||
|
foreach my $a (@addrs) {
|
||||||
|
my $sym;
|
||||||
|
if (exists($symbols->{$a})) {
|
||||||
|
$sym = $symbols->{$a}->[0];
|
||||||
|
} else {
|
||||||
|
$sym = $a;
|
||||||
|
}
|
||||||
|
if ($main::opt_retain ne '' && $sym !~ m/$main::opt_retain/) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if ($main::opt_exclude ne '' && $sym =~ m/$main::opt_exclude/) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
push(@path, $a);
|
||||||
|
}
|
||||||
|
if (scalar(@path) > 0) {
|
||||||
|
my $reduced_path = join("\n", @path);
|
||||||
|
AddEntry($result, $reduced_path, $count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
sub RemoveUninterestingFrames {
|
sub RemoveUninterestingFrames {
|
||||||
my $symbols = shift;
|
my $symbols = shift;
|
||||||
my $profile = shift;
|
my $profile = shift;
|
||||||
@ -2984,6 +3027,9 @@ sub RemoveUninterestingFrames {
|
|||||||
my $reduced_path = join("\n", @path);
|
my $reduced_path = join("\n", @path);
|
||||||
AddEntry($result, $reduced_path, $count);
|
AddEntry($result, $reduced_path, $count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = FilterFrames($symbols, $result);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user