Removed build system from master branch, will relocate to linux-zfs-branch
[zfs.git] / scripts / profile-kpios-post.sh
1 #!/bin/bash
2
3 prog=profile-kpios-post.sh
4 . ../.script-config
5
6 RUN_POST=${0}
7 RUN_PHASE=${1}
8 RUN_LOG_DIR=${2}
9 RUN_ID=${3}
10 RUN_POOL=${4}
11 RUN_CHUNK_SIZE=${5}
12 RUN_REGION_SIZE=${6}
13 RUN_THREAD_COUNT=${7}
14 RUN_REGION_COUNT=${8}
15 RUN_OFFSET=${9}
16 RUN_REGION_NOISE=${10}
17 RUN_CHUNK_NOISE=${11}
18 RUN_THREAD_DELAY=${12}
19 RUN_FLAGS=${13}
20 RUN_RESULT=${14}
21
22 PROFILE_KPIOS_PIDS_BIN=/home/behlendo/src/zfs/scripts/profile-kpios-pids.sh
23 PROFILE_KPIOS_PIDS_LOG=${RUN_LOG_DIR}/${RUN_ID}/pids-summary.csv
24
25 PROFILE_KPIOS_DISK_BIN=/home/behlendo/src/zfs/scripts/profile-kpios-disk.sh
26 PROFILE_KPIOS_DISK_LOG=${RUN_LOG_DIR}/${RUN_ID}/disk-summary.csv
27
28 PROFILE_KPIOS_ARC_LOG=${RUN_LOG_DIR}/${RUN_ID}/arcstats
29 PROFILE_KPIOS_VDEV_LOG=${RUN_LOG_DIR}/${RUN_ID}/vdev_cache_stats
30
31 KERNEL_BIN="/lib/modules/`uname -r`/kernel/"
32 SPL_BIN="${SPLBUILD}/modules/spl/"
33 ZFS_BIN="${ZFSBUILD}/lib/"
34
35 OPROFILE_SHORT_ARGS="-a -g -l -p ${KERNEL_BIN},${SPL_BIN},${ZFS_BIN}"
36 OPROFILE_LONG_ARGS="-d -a -g -l -p ${KERNEL_BIN},${SPL_BIN},${ZFS_BIN}"
37
38 OPROFILE_LOG=${RUN_LOG_DIR}/${RUN_ID}/oprofile.txt
39 OPROFILE_SHORT_LOG=${RUN_LOG_DIR}/${RUN_ID}/oprofile-short.txt
40 OPROFILE_LONG_LOG=${RUN_LOG_DIR}/${RUN_ID}/oprofile-long.txt
41 PROFILE_PID=${RUN_LOG_DIR}/${RUN_ID}/pid
42
43 if [ "${RUN_PHASE}" != "post" ]; then
44         exit 1
45 fi
46
47 # opcontrol --stop >>${OPROFILE_LOG} 2>&1
48 # opcontrol --dump >>${OPROFILE_LOG} 2>&1
49
50 kill -s SIGHUP `cat ${PROFILE_PID}`
51 rm -f ${PROFILE_PID}
52
53 # opreport ${OPROFILE_SHORT_ARGS} >${OPROFILE_SHORT_LOG} 2>&1
54 # opreport ${OPROFILE_LONG_ARGS} >${OPROFILE_LONG_LOG} 2>&1
55
56 # opcontrol --deinit >>${OPROFILE_LOG} 2>&1
57
58 cat /proc/spl/kstat/zfs/arcstats >${PROFILE_KPIOS_ARC_LOG}
59 cat /proc/spl/kstat/zfs/vdev_cache_stats >${PROFILE_KPIOS_VDEV_LOG}
60
61 # Summarize system time per pid
62 ${PROFILE_KPIOS_PIDS_BIN} ${RUN_LOG_DIR} ${RUN_ID} >${PROFILE_KPIOS_PIDS_LOG}
63
64 # Summarize per device performance
65 ${PROFILE_KPIOS_DISK_BIN} ${RUN_LOG_DIR} ${RUN_ID} >${PROFILE_KPIOS_DISK_LOG}
66
67 exit 0