1 Star 1 Fork 0

lucashliu/FlameGraph

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
stackcollapse-aix.pl 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/perl -ws
#
# stackcollapse-aix Collapse AIX /usr/bin/procstack backtraces
#
# Parse a list of backtraces as generated with the poor man's aix-perf.pl
# profiler
#
use strict;
my $process = "";
my $current = "";
my $previous_function = "";
my %stacks;
while(<>) {
chomp;
if (m/^\d+:/) {
if(!($current eq "")) {
$current = $process . ";" . $current;
$stacks{$current} += 1;
$current = "";
}
m/^\d+: ([^ ]*)/;
$process = $1;
$current = "";
}
elsif(m/^---------- tid# \d+/){
if(!($current eq "")) {
$current = $process . ";" . $current;
$stacks{$current} += 1;
}
$current = "";
}
elsif(m/^(0x[0-9abcdef]*) *([^ ]*) ([^ ]*) ([^ ]*)/) {
my $function = $2;
my $alt = $1;
$function=~s/\(.*\)?//;
if($function =~ /^\[.*\]$/) {
$function = $alt;
}
if ($current) {
$current = $function . ";" . $current;
}
else {
$current = $function;
}
}
}
if(!($current eq "")) {
$current = $process . ";" . $current;
$stacks{$current} += 1;
$current = "";
$process = "";
}
foreach my $k (sort { $a cmp $b } keys %stacks) {
print "$k $stacks{$k}\n";
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lucashliu/FlameGraph.git
git@gitee.com:lucashliu/FlameGraph.git
lucashliu
FlameGraph
FlameGraph
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385