#!/bin/bash # Linux interactivity profiler script # requires profile=2 (or 1?) as a kernel boot param # Script takes optional number of iterations # param., default is 10 iterations # reset the profiler /usr/sbin/readprofile -r KERN=$(uname -r) OUT_DIR=/root/profs/ #[ -w ${OUT_DIR} ] || OUT_DIR=$(pwd) if [ -z $1 ]; then ITS=10 else ITS=$1 fi # Collect vmstat output vmstat 1 ${ITS}|cat -n > ${OUT_DIR}/${KERN}-vmstat & # Collect top output top b d1 n${ITS} > ${OUT_DIR}/${KERN}-top & n=1 # Collect profile while [ ${n} -le ${ITS} ]; do /usr/sbin/readprofile -n -m /boot/System.map-${KERN} \ | sort -nr -k 3,3 > ${OUT_DIR}/${KERN}-prof.${n} n=$(( ${n} + 1 )) sleep 1 done