Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/rc/bin/kmem – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
# kmem [kernel] - print summary of allocate blocks in running kernel
3
rfork e
4
if(! ~ $#* 0 1){
5
	echo 'usage: kmem [kernel]' >[1=2]
6
	exit usage
7
}
8
 
9
if(~ $#* 1)
10
	binary=$1
11
 
12
echo 'kinit(); blocksummary()' | acid -k -lkernel -lpool -lleak $pid $binary | awk '
13
	$1 == "block" {
14
		addr=$6
15
		size=$3
16
		alloc=$4
17
		total[alloc] += size
18
		count[alloc]++
19
	}
20
	$1 == "summary" { 
21
		alloc=$2
22
		cnt=$3
23
		size=$4
24
		total[alloc] += size
25
		count[alloc] += cnt
26
	}
27
	END{
28
		for(i in count)
29
			printf("%6d %11d %s\n", count[i], total[i], i);
30
	}
31
' | sort -nr