blob: 2886b1aaa904d77855dadda985a3d5c70dc4abad (
plain)
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
|
#!/bin/rc
# umem pid [binary] - print summary of allocate blocks in a running process
rfork e
if(! ~ $#* 1 2){
echo 'usage: umem pid [binary]' >[1=2]
exit usage
}
p=$1
binary=()
if(~ $#* 2)
binary=$2
echo 'blocksummary()' | acid -lpool -lleak $p $binary | awk '
$1 == "block" {
addr=$6
size=$3
alloc=$4
total[alloc] += size
count[alloc]++
}
$1 == "summary" {
alloc=$2
cnt=$3
size=$4
total[alloc] += size
count[alloc] += cnt
}
END{
for(i in count)
printf("%6d %11d %s\n", count[i], total[i], i);
}
' | sort -nr
|