]> git.proxmox.com Git - mirror_zfs-debian.git/blame - scripts/zpios-profile/zpios-profile-post.sh
Add initial autoconf products
[mirror_zfs-debian.git] / scripts / zpios-profile / zpios-profile-post.sh
CommitLineData
302ef151
BB
1#!/bin/bash
2
3PROG=zpios-profile-post.sh
4
5RUN_POST=${0}
6RUN_PHASE=${1}
7RUN_DIR=${2}
8RUN_ID=${3}
9RUN_POOL=${4}
10RUN_CHUNK_SIZE=${5}
11RUN_REGION_SIZE=${6}
12RUN_THRD_COUNT=${7}
13RUN_REGION_COUNT=${8}
14RUN_OFFSET=${9}
15RUN_REGION_NOISE=${10}
16RUN_CHUNK_NOISE=${11}
17RUN_THRD_DELAY=${12}
18RUN_FLAGS=${13}
19RUN_RESULT=${14}
20
21# Summarize system time per process
22zpios_profile_post_pids() {
23 ${PROFILE_PIDS} ${PROFILE_RUN_CR_PIDS_LOG} >${PROFILE_RUN_CR_PIDS_CSV}
24 ${PROFILE_PIDS} ${PROFILE_RUN_WR_PIDS_LOG} >${PROFILE_RUN_WR_PIDS_CSV}
25 ${PROFILE_PIDS} ${PROFILE_RUN_RD_PIDS_LOG} >${PROFILE_RUN_RD_PIDS_CSV}
26 ${PROFILE_PIDS} ${PROFILE_RUN_RM_PIDS_LOG} >${PROFILE_RUN_RM_PIDS_CSV}
27}
28
29zpios_profile_post_disk() {
30 ${PROFILE_DISK} ${PROFILE_RUN_CR_DISK_LOG} >${PROFILE_RUN_CR_DISK_CSV}
31 ${PROFILE_DISK} ${PROFILE_RUN_WR_DISK_LOG} >${PROFILE_RUN_WR_DISK_CSV}
32 ${PROFILE_DISK} ${PROFILE_RUN_RD_DISK_LOG} >${PROFILE_RUN_RD_DISK_CSV}
33 ${PROFILE_DISK} ${PROFILE_RUN_RM_DISK_LOG} >${PROFILE_RUN_RM_DISK_CSV}
34}
35
36# Summarize per device performance
37
38# Stop a user defined profiling script which is gathering additional data
39zpios_profile_post_stop() {
40 local PROFILE_PID=$1
41
42 kill -s SIGHUP `cat ${PROFILE_PID}`
43
44
45 # Sleep waiting for profile script to exit
46 while [ -f ${PROFILE_PID} ]; do
47 sleep 0.01
48 done
49}
50
51zpios_profile_post_proc_stop() {
52 local PROC_DIR=$1
53
54 if [ -f ${PROFILE_ARC_PROC} ]; then
55 cat ${PROFILE_ARC_PROC} >${PROC_DIR}/arcstats.txt
56 fi
57
58 if [ -f ${PROFILE_VDEV_CACHE_PROC} ]; then
59 cat ${PROFILE_VDEV_CACHE_PROC} >${PROC_DIR}/vdev_cache_stats.txt
60 fi
61}
62
63zpios_profile_post_oprofile_stop() {
64 local OPROFILE_LOG=$1
65 local OPROFILE_ARGS="-a -g -l -p ${OPROFILE_KERNEL_DIR},${OPROFILE_SPL_DIR},${OPROFILE_ZFS_DIR}"
66
67 /usr/bin/opcontrol --stop >>${OPROFILE_LOG} 2>&1
68 /usr/bin/opcontrol --dump >>${OPROFILE_LOG} 2>&1
69 /usr/bin/opreport ${OPROFILE_ARGS} >${OPROFILE_LOG} 2>&1
70 /usr/bin/oparchive
71}
72
73zpios_profile_post_create() {
74 zpios_profile_post_oprofile_stop ${PROFILE_RUN_CR_OPROFILE_LOG}
75 zpios_profile_post_proc_stop ${PROFILE_RUN_CR_DIR}
76 zpios_profile_post_stop ${PROFILE_RUN_CR_PID}
77}
78
79zpios_profile_post_write() {
80 zpios_profile_post_oprofile_stop ${PROFILE_RUN_WR_OPROFILE_LOG}
81 zpios_profile_post_proc_stop ${PROFILE_RUN_WR_DIR}
82 zpios_profile_post_stop ${PROFILE_RUN_WR_PID}
83}
84
85zpios_profile_post_read() {
86 zpios_profile_post_oprofile_stop ${PROFILE_RUN_CR_RD_LOG}
87 zpios_profile_post_proc_stop ${PROFILE_RUN_RD_DIR}
88 zpios_profile_post_stop ${PROFILE_RUN_RD_PID}
89}
90
91zpios_profile_post_remove() {
92 zpios_profile_post_oprofile_stop ${PROFILE_RUN_RM_OPROFILE_LOG}
93 zpios_profile_post_proc_stop ${PROFILE_RUN_RM_DIR}
94 zpios_profile_post_stop ${PROFILE_RUN_RM_PID}
95}
96
97# Source global zpios test configuration
98if [ -f ${RUN_DIR}/zpios-config.sh ]; then
99 . ${RUN_DIR}/zpios-config.sh
100fi
101
102# Source global per-run test configuration
103if [ -f ${RUN_DIR}/${RUN_ID}/zpios-config-run.sh ]; then
104 . ${RUN_DIR}/${RUN_ID}/zpios-config-run.sh
105fi
106
107case "${RUN_PHASE}" in
108 post-run)
109 zpios_profile_post_pids
110 zpios_profile_post_disk
111 ;;
112 post-create)
113 zpios_profile_post_create
114 ;;
115 post-write)
116 zpios_profile_post_write
117 ;;
118 post-read)
119 zpios_profile_post_read
120 ;;
121 post-remove)
122 zpios_profile_post_remove
123 ;;
124 *)
125 echo "Usage: ${PROG} {post-run|post-create|post-write|post-read|post-remove}"
126 exit 1
127esac
128
129exit 0