Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/umem/umem.backup

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# umem pid - print summary of allocate blocks in a running process
if(! ~ $#* 1){
	echo 'usage: umem pid' >[1=2]
	exit usage
}

pid=$1
echo 'blocksummary()' | acid -lpool -lleak $pid | 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

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].