#!/bin/sh
#
# remake the numa archive ...
# this archive is intended to be checked in and not remade, this script is
# simply a record of how it was created
#

. /etc/pcp.env

tmp=/var/tmp/$$
rm -f $tmp.*
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15

nnode=`pmprobe -v hinv.nnode | $PCP_AWK_PROG '{print $NF}'`
if [ -z "$nnode" -o "$nnode" -lt 2 ]
then
    echo "$0: Error: hinv.nnode ($nnode) not > 1"
    exit 1
fi

cat <<End-of-File >>$tmp.config
log mandatory on once {
    hinv
}

log mandatory on 1 sec {
    mem.numa.alloc
    kernel.pernode
End-of-File

pminfo mem.vmstat | grep numa_ | sed -e 's/^/    /' >>$tmp.config

echo "}" >>$tmp.config

rm -f numa.0 numa.meta numa.index

pmlogger -s 10 -c $tmp.config numa
