[Ocfs2-test-devel] [PATCH 2/3] Ocfs2-test: Add single-node testing script for inode_alloc_perf_test

Tristan Ye tristan.ye at oracle.com
Sat Jan 31 19:06:33 PST 2009


The testing script based on tao's testcase for inode allocation performance test.
It helps to run a performance comparison tests between a original and patched kernel
on inode allocation, deletion and traversing etc. which automates the testing procedures
of patch applying,kernel rebuilding etc, and also calculate a human-readable testing report
by the end.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 programs/inode_alloc_perf_test/inode_alloc_perf.sh |  652 ++++++++++++++++++++
 1 files changed, 652 insertions(+), 0 deletions(-)
 create mode 100755 programs/inode_alloc_perf_test/inode_alloc_perf.sh

diff --git a/programs/inode_alloc_perf_test/inode_alloc_perf.sh b/programs/inode_alloc_perf_test/inode_alloc_perf.sh
new file mode 100755
index 0000000..7a86bca
--- /dev/null
+++ b/programs/inode_alloc_perf_test/inode_alloc_perf.sh
@@ -0,0 +1,652 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Oracle.  All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License, version 2,  as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 021110-1307, USA.
+#
+#
+# Description:  The script helps to run a performance comparison tests between 
+# 		a original and a enhanced(with inode alloc patches) kernel on 
+#		inode allocation, deletion and traversing etc.
+#               test.
+#
+# Author:       Tristan Ye,     tristan.ye at oracle.com
+#
+# History:      20 Jan 2009
+#
+################################################################################
+# Global Variables
+################################################################################
+
+PATH=$PATH:/sbin      # Add /sbin to the path for ocfs2 tools
+export PATH=$PATH:.
+
+. ./config.sh
+
+SUDO="`which sudo` -u root"
+RM_BIN="`which rm`"
+TEE_BIN=`which tee`
+MKDIR_BIN="`which mkdir`"
+TOUCH_BIN="`which touch`"
+TAR_BIN="`which tar`"
+LS_BIN="`which ls --skip-alias`"
+LI_BIN="$LS_BIN"
+TIME_BIN="`which time`"
+
+CHOWN_BIN=`which chown`
+CHMOD_BIN=`which chmod`
+
+MOUNT_BIN="`which sudo` -u root `which mount`"
+UMOUNT_BIN="`which sudo` -u root `which umount`"
+MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
+DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
+
+MOUNT_POINT=
+DEVICE=
+KERNEL_PATH=
+KERNEL_TARBALL=
+PATCH_PATH=
+ISCSI_SERVER=
+ITERATION=1
+
+BLOCKSIZE=4K
+CLUSTERSIZE=4K
+SLOTS=
+JOURNALSIZE=
+BLOCKS=
+LABELNAME=ocfs2-inode-alloc-perf-tests
+
+DEFAULT_LOG_DIR=${O2TDIR}/log
+LOG_DIR=
+RUN_LOG_FILE=
+LOG_FILE=
+MKFSLOG=
+MOUNTLOG=
+
+TEST_PASS=0
+TEST_NO=0
+
+#record the original commitid of kernel tree before applying the patches
+ORIG_COMMITID=
+
+set -o pipefail
+
+BOOTUP=color
+RES_COL=80
+MOVE_TO_COL="echo -en \\033[${RES_COL}G"
+SETCOLOR_SUCCESS="echo -en \\033[1;32m"
+SETCOLOR_FAILURE="echo -en \\033[1;31m"
+SETCOLOR_WARNING="echo -en \\033[1;33m"
+SETCOLOR_NORMAL="echo -en \\033[0;39m"
+
+################################################################################
+# Utility Functions
+################################################################################
+function f_echo_success()
+{
+        [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+                echo -n "["
+        [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
+                echo -n $" PASS "
+        [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+                echo -n "]"
+
+        return 0
+}
+
+function f_echo_failure()
+{
+        [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+                echo -n "["
+        [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+                echo -n $"FAILED"
+        [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+                echo -n "]"
+
+        return 1
+}
+
+function f_echo_status()
+{
+        if [ "${1}" == "0" ];then
+                f_echo_success
+                echo
+        else
+                f_echo_failure
+                echo
+                exit 1
+        fi
+}
+
+function f_exit_or_not()
+{
+        if [ "${1}" != "0" ];then
+                exit 1;
+        fi
+}
+
+function f_usage()
+{
+        echo "usage: `basename ${0}` [-o logdir] [-i iterations] <-d device> <-t kernel src tarball> <-k kernel path> <-p patches path> [-s iscsi server] <mountpoint path>"
+        echo "       -o output directory for the logs"
+        echo "       -d block device name used for ocfs2 volume"
+        echo "       -t tarball of kernel src for test"
+        echo "       -k path of currently used/complied kernel"
+        echo "       -p path of newly released patches for kernel"
+        echo "       -s specify iscsi server for iscsi-target cache dropping,use local disk by default"
+        echo "       -i specify the iteration of test"
+        echo "       <mountpoint path> path of mountpoint where the ocfs2 volume will be mounted on."
+        exit 1;
+}
+
+function f_getoptions()
+{
+        if [ $# -eq 0 ]; then
+                f_usage;
+                exit 1
+         fi
+
+         while getopts "o:hd:t:k:i:p:s:" options; do
+                case $options in
+                o ) LOG_DIR="$OPTARG";;
+                d ) DEVICE="$OPTARG";;
+                t ) KERNEL_TARBALL="$OPTARG";;
+                k ) KERNEL_PATH="$OPTARG";;
+                p ) PATCH_PATH="$OPTARG";;
+                s ) ISCSI_SERVER="$OPTARG";;
+                i ) ITERATION="$OPTARG";;
+                h ) f_usage;;
+                * ) f_usage;;
+                esac
+        done
+        shift $(($OPTIND -1))
+        MOUNT_POINT=${1}
+}
+
+function f_check()
+{
+        f_getoptions $*
+
+        if [ -z "${MOUNT_POINT}" ];then
+                f_usage
+        else
+                if [ ! -d ${MOUNT_POINT} ]; then
+                        echo "Mount point ${MOUNT_POINT} does not exist."
+                        exit 1
+                else
+                        #To assure that mount point will not end with a trailing '/'
+                        if [ "`dirname ${MOUNT_POINT}`" = "/" ]; then
+                                MOUNT_POINT="`dirname ${MOUNT_POINT}``basename ${MOUNT_POINT}`"
+                        else
+                                MOUNT_POINT="`dirname ${MOUNT_POINT}`/`basename ${MOUNT_POINT}`"
+                        fi
+                fi
+        fi
+
+	if [ -z "${DEVICE}" ];then
+		echo "Should specify the device"
+		exit 1
+	fi
+
+	if [ -z "${KERNEL_TARBALL}" ];then
+		echo "Should specify tarball of kernel src"
+		exit 1
+	fi
+
+	if [ -z "${KERNEL_PATH}" ];then
+		echo "Should specify the path of currently used kernel"
+		exit 1
+	fi
+
+	if [ -z "${PATCH_PATH}" ];then
+		echo "Should specify the path of desired patches"
+		exit 1
+	fi
+
+        LOG_DIR=${LOG_DIR:-$DEFAULT_LOG}
+
+        ${MKDIR_BIN} -p ${LOG_DIR} || exit 1
+
+        RUN_LOG_FILE="`dirname ${LOG_DIR}`/`basename ${LOG_DIR}`/`date +%F-%H-%M-%S`-inode-alloc-perf-tests-run.log"
+        LOG_FILE="`dirname ${LOG_DIR}`/`basename ${LOG_DIR}`/`date +%F-%H-%M-%S`-inode-alloc-perf-tests.log"
+        MKFSLOG="`dirname ${LOG_DIR}`/`basename ${LOG_DIR}`/$$_mkfs.log"
+        MOUNTLOG="`dirname ${LOG_DIR}`/`basename ${LOG_DIR}`/$$_mount.log"
+
+	TIME_STAT_LOG_PREFIX="`dirname ${LOG_DIR}`/`basename ${LOG_DIR}`/`date +%F-%H-%M-%S`-inode-alloc-perf-tests-time-stat"
+
+	
+}
+
+function f_LogRunMsg()
+{
+        echo -ne "$@"| ${TEE_BIN} -a ${RUN_LOG_FILE}
+}
+
+function f_LogMsg()
+{
+        echo "$(date +%Y/%m/%d,%H:%M:%S)  $@" >>${LOG_FILE}
+}
+
+function f_RecordOrigCommitID()
+{
+	f_LogMsg "Try to record the original commitid of target kernel tree"
+	OLD_DIR=${PWD}
+
+	cd ${KERNEL_PATH}
+
+	ORIG_COMMITID=`git log|sed -n '1p'|awk '{print $2}'` || {
+		f_LogMsg "Failed to get last commitid of kernel tree, you may wrongly specify a kernel tree"
+		return 1
+	}
+
+	f_LogMsg "Get original commitid = ${ORIG_COMMITID}"
+
+	cd ${OLD_DIR}
+}
+
+function f_ApplyPatches()
+{
+	f_LogMsg "Try to apply the patches on target kernel tree"
+	OLD_DIR=${PWD}
+
+	cd ${KERNEL_PATH}
+
+	for PATCH in `ls ${PATCH_PATH}`;do
+		PATCH_ABS=${PATCH_PATH}/${PATCH}
+		cat ${PATCH_ABS}| git am >> ${LOG_FILE} || {
+			f_LogMsg "Failed to apply patch ${PATCH_ABS}"
+			return 1
+		}
+	done
+
+	cd ${OLD_DIR}
+}
+
+function f_ResetCommitID()
+{
+	f_LogMsg "Try to reset kernel with original commit ID"
+
+	OLD_DIR=${PWD}
+
+	cd ${KERNEL_PATH}
+
+	git reset ${ORIG_COMMITID} --hard >> ${LOG_FILE}|| {
+		f_LogMsg "Failed to reset commitid(${ORIG_COMMITID}) for kernel"
+		return 1
+
+	}
+	
+	cd ${OLD_DIR}
+}
+
+function f_Rebuild_Kernel()
+{
+	f_LogMsg "Try to rebuild kernel,then restart oc2b service"
+
+	OLD_DIR=${PWD}
+	
+	cd ${KERNEL_PATH}
+
+	make SUBDIRS=fs/ocfs2 >> ${LOG_FILE} 2>&1 || {
+		f_LogMsg "Failed to make ocfs2 subdirs"
+		return 1
+	}
+
+	RC=0
+	cp fs/ocfs2/ocfs2.ko /lib/modules/`uname -r`/kernel/fs/ocfs2/ocfs2.ko
+	RC=$((${RC}+$?))
+	cp fs/ocfs2/dlm/ocfs2_dlm.ko /lib/modules/`uname -r`/kernel/fs/ocfs2/dlm/ocfs2_dlm.ko
+	RC=$((${RC}+$?))
+	cp fs/ocfs2/dlm/ocfs2_dlmfs.ko /lib/modules/`uname -r`/kernel/fs/ocfs2/dlm/ocfs2_dlmfs.ko
+	RC=$((${RC}+$?))
+	cp fs/ocfs2/cluster/ocfs2_nodemanager.ko /lib/modules/`uname -r`/kernel/fs/ocfs2/cluster/ocfs2_nodemanager.ko
+	RC=$((${RC}+$?))
+
+	if [ "${RC}" != "0" ];then
+                f_LogMsg "Failed to install ocfs2 modules"
+                return 1
+        fi
+
+	RC=0
+
+	${SUDO} /etc/init.d/o2cb offline >> ${LOG_FILE} 2>&1
+	RC=$((${RC}+$?))
+	${SUDO} /etc/init.d/o2cb unload >> ${LOG_FILE} 2>&1
+	RC=$((${RC}+$?))
+
+	${SUDO} /etc/init.d/o2cb load >> ${LOG_FILE} 2>&1
+	RC=$((${RC}+$?))
+	${SUDO} /etc/init.d/o2cb online >> ${LOG_FILE} 2>&1
+	RC=$((${RC}+$?))
+
+	if [ "${RC}" != "0" ];then
+		f_LogMsg "Failed to restart o2cb service"
+		return 1
+	fi
+
+	${SUDO} ${DEBUGFS_BIN} -l BH_IO allow
+	${SUDO} ${DEBUGFS_BIN} -l UPTODATE allow
+
+	cd ${OLD_DIR}
+
+}
+
+function f_mkfs()
+{
+	f_LogMsg "Mkfs volume ${DEVICE} by ${BLOCKSIZE} bas and ${CLUSTERSIZE} cs"
+	echo "y"|${MKFS_BIN} -b ${BLOCKSIZE} -C ${CLUSTERSIZE} -L ${LABELNAME} -M local ${DEVICE}>>${MKFSLOG} 2>&1
+	RET=$?
+
+	if [ "${RET}" != "0" ];then
+		f_LogMsg "Mkfs failed"
+		exit 1
+	fi
+}
+function f_mount()
+{
+	f_LogMsg "Mount Volume ${DEVICE} to ${MOUNT_POINT}"
+	${MOUNT_BIN} -t ocfs2 ${DEVICE} ${MOUNT_POINT} >>${MOUNTLOG} 2>&1
+	RET=$?
+
+	if [ "${RET}" != "0" ];then
+                f_LogMsg "Mount volume failed"
+                exit 1
+        fi
+
+	${SUDO} ${CHMOD_BIN} -R 777 ${MOUNT_POINT}  >>${LOG_FILE} 2>&1
+        ${SUDO} ${CHOWN_BIN} -R ${USERNAME}:${GROUPNAME} ${MOUNT_POINT} >>${LOG_FILE} 2>&1
+}
+function f_umount()
+{
+        f_LogMsg "Umount volume ${DEVICE} from ${MOUNT_POINT}"
+        ${UMOUNT_BIN} ${MOUNT_POINT} >>${MOUNTLOG} 2>&1
+        RET=$?
+
+	if [ "${RET}" != "0" ];then
+                f_LogMsg "Umount failed"
+                exit 1
+        fi
+}
+
+#${1} specify the testing type
+#${2} specify the testing number
+function f_run_test_one_time()
+{
+
+	TIME_STAT_LOG=${TIME_STAT_LOG_PREFIX}-${2}.log.${1}
+
+	f_LogMsg "Run #${2} Testing iteration with ${1} kernel"
+	echo "1st Tar">>${TIME_STAT_LOG}
+	f_LogMsg "1st Tar"
+	f_mount
+	echo 2 > /proc/sys/vm/drop_caches
+	#read -p "Pause here:" answer
+
+	${TIME_BIN} -ao ${TIME_STAT_LOG} -p ${TAR_BIN} jxvf ${KERNEL_TARBALL} -C ${MOUNT_POINT} 1>/dev/null || {
+		f_LogMsg "Failed at Iteration:[${2}],Type:[${1} kernel] on 1st Tar"
+		exit 1
+	}
+
+	echo "1st Ls" >> ${TIME_STAT_LOG}
+	f_LogMsg "1st Ls"
+	f_umount
+
+	#read -p "Pause here:" answer
+	f_mount
+	echo 2 > /proc/sys/vm/drop_caches
+	sleep 1
+	${TIME_BIN} -ao ${TIME_STAT_LOG} -p ${LS_BIN} -lR ${MOUNT_POINT} 1>/dev/null || {
+		f_LogMsg "Failed at Iteration:[${2}],Type:[${1} kernel] on 1st Ls"
+                exit 1
+	}
+
+
+	echo "1st Rm" >> ${TIME_STAT_LOG}
+	f_LogMsg "1st Rm"
+	f_umount
+	#read -p "Pause here:" answer
+	f_mount
+	echo 2 > /proc/sys/vm/drop_caches
+	${TIME_BIN} -ao ${TIME_STAT_LOG} -p ${RM_BIN} ${MOUNT_POINT}/linux* -rf || {
+		f_LogMsg "Failed at Iteration:[${2}],Type:[${1} kernel] on 1st Rm"
+                exit 1
+	}
+
+	echo "2nd Tar" >> ${TIME_STAT_LOG}
+	f_LogMsg "2nd Tar"
+	f_umount
+	#read -p "Pause here:" answer
+	f_mount
+	echo 2 > /proc/sys/vm/drop_caches
+	${TIME_BIN} -ao ${TIME_STAT_LOG} -p ${TAR_BIN} jxvf ${KERNEL_TARBALL} -C ${MOUNT_POINT} 1>/dev/null || {
+		f_LogMsg "Failed at Iteration:[${2}],Type:[${1} kernel] on 2nd Tar"
+                exit 1
+	}
+
+	echo "2nd Ls" >> ${TIME_STAT_LOG}
+	f_LogMsg "2nd Ls"
+	f_umount
+	#read -p "Pause here:" answer
+	f_mount
+	echo 2 > /proc/sys/vm/drop_caches
+	sleep 1
+	${TIME_BIN} -ao ${TIME_STAT_LOG} -p ${LS_BIN} -lR ${MOUNT_POINT} 1>/dev/null || {
+		f_LogMsg "Failed at Iteration:[${2}],Type:[${1} kernel] on 2nd Ls"
+                exit 1
+	}
+
+	echo "2nd Rm" >> ${TIME_STAT_LOG}
+	f_LogMsg "2nd Rm"
+	f_umount
+	#read -p "Pause here:" answer
+	f_mount
+	echo 2 > /proc/sys/vm/drop_caches
+	${TIME_BIN} -ao ${TIME_STAT_LOG} -p ${RM_BIN} ${MOUNT_POINT}/linux* -rf || {
+		f_LogMsg "Failed at Iteration:[${2}],Type:[${1} kernel] on 2nd Rm"
+                exit 1
+	}
+
+	f_umount
+
+	((TEST_PASS++))
+	
+	return 0
+}
+
+function f_run_test()
+{
+	f_LogRunMsg "Recording last commitid of original kernel tree:"
+	f_RecordOrigCommitID
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	f_LogRunMsg "Applying patches:"
+	f_ApplyPatches 
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	f_LogRunMsg "Rebuilding kernel:"
+	f_Rebuild_Kernel
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	f_LogRunMsg "Mkfsing ${DEVICE}:"
+        f_mkfs
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+	
+	f_LogRunMsg "Running tests with ${ITERATION} times on patched kernel:"
+	for i in $(seq ${ITERATION});do
+        	f_run_test_one_time "patched" ${i}
+	done
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	f_LogRunMsg "Resetting commitid of original kernel tree:"
+	f_ResetCommitID 
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	f_LogRunMsg "Rebuilding kernel:"
+	f_Rebuild_Kernel
+	RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	f_LogRunMsg "Running tests with ${ITERATION} times on original kernel:"
+        for i in $(seq ${ITERATION});do
+                f_run_test_one_time "original" ${i}
+        done
+        RET=$?
+        f_echo_status ${RET} | tee -a ${RUN_LOG_FILE}
+	f_exit_or_not ${RET}
+
+	return 0
+}
+
+f_stat_time_consumed()
+{
+
+	PATCHED_AVER_1ST_TAR_TIME=0
+	PATCHED_AVER_1ST_LS_TIME=0
+	PATCHED_AVER_1ST_RM_TIME=0
+	PATCHED_AVER_2ND_TAR_TIME=0
+        PATCHED_AVER_2ND_LS_TIME=0
+        PATCHED_AVER_2ND_RM_TIME=0
+
+	ORIG_AVER_1ST_TAR_TIME=0
+        ORIG_AVER_1ST_LS_TIME=0
+        ORIG_AVER_1ST_RM_TIME=0
+        ORIG_AVER_2ND_TAR_TIME=0
+        ORIG_AVER_2ND_LS_TIME=0
+        ORIG_AVER_2ND_RM_TIME=0
+
+	TEMP_READ_TIME=0
+	
+	f_LogRunMsg "=====================Time Consumed Statistics(${ITERATION} iterations)=====================\n"
+	f_LogMsg "=====================Time Consumed Statistics(${ITERATION} iterations)====================="
+
+	for i in $(seq ${ITERATION});do
+
+		PATCHED_TIME_STAT_LOG=${TIME_STAT_LOG_PREFIX}-${i}.log.patched
+		ORIG_TIME_STAT_LOG=${TIME_STAT_LOG_PREFIX}-${i}.log.original
+		
+		TEMP_READ_TIME=`sed -n '/1st Tar/{n;p}' ${PATCHED_TIME_STAT_LOG} | awk '{print $2}'`
+		PATCHED_AVER_1ST_TAR_TIME=`echo ${PATCHED_AVER_1ST_TAR_TIME}+${TEMP_READ_TIME}|bc`
+
+		TEMP_READ_TIME=`sed -n '/1st Ls/{n;p}' ${PATCHED_TIME_STAT_LOG} | awk '{print $2}'`
+                PATCHED_AVER_1ST_LS_TIME=`echo ${PATCHED_AVER_1ST_LS_TIME}+${TEMP_READ_TIME}|bc`
+
+		TEMP_READ_TIME=`sed -n '/1st Rm/{n;p}' ${PATCHED_TIME_STAT_LOG} | awk '{print $2}'`
+                PATCHED_AVER_1ST_RM_TIME=`echo ${PATCHED_AVER_1ST_RM_TIME}+${TEMP_READ_TIME}|bc`
+
+		TEMP_READ_TIME=`sed -n '/2nd Tar/{n;p}' ${PATCHED_TIME_STAT_LOG} | awk '{print $2}'`
+                PATCHED_AVER_2ND_TAR_TIME=`echo ${PATCHED_AVER_2ND_TAR_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/2nd Ls/{n;p}' ${PATCHED_TIME_STAT_LOG} | awk '{print $2}'`
+                PATCHED_AVER_2ND_LS_TIME=`echo ${PATCHED_AVER_2ND_LS_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/2nd Rm/{n;p}' ${PATCHED_TIME_STAT_LOG} | awk '{print $2}'`
+                PATCHED_AVER_2ND_RM_TIME=`echo ${PATCHED_AVER_2ND_RM_TIME}+${TEMP_READ_TIME}|bc`
+
+
+		TEMP_READ_TIME=`sed -n '/1st Tar/{n;p}' ${ORIG_TIME_STAT_LOG} | awk '{print $2}'`
+                ORIG_AVER_1ST_TAR_TIME=`echo ${ORIG_AVER_1ST_TAR_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/1st Ls/{n;p}' ${ORIG_TIME_STAT_LOG} | awk '{print $2}'`
+                ORIG_AVER_1ST_LS_TIME=`echo ${ORIG_AVER_1ST_LS_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/1st Rm/{n;p}' ${ORIG_TIME_STAT_LOG} | awk '{print $2}'`
+                ORIG_AVER_1ST_RM_TIME=`echo ${ORIG_AVER_1ST_RM_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/2nd Tar/{n;p}' ${ORIG_TIME_STAT_LOG} | awk '{print $2}'`
+                ORIG_AVER_2ND_TAR_TIME=`echo ${ORIG_AVER_2ND_TAR_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/2nd Ls/{n;p}' ${ORIG_TIME_STAT_LOG} | awk '{print $2}'`
+                ORIG_AVER_2ND_LS_TIME=`echo ${ORIG_AVER_2ND_LS_TIME}+${TEMP_READ_TIME}|bc`
+
+                TEMP_READ_TIME=`sed -n '/2nd Rm/{n;p}' ${ORIG_TIME_STAT_LOG} | awk '{print $2}'`
+                ORIG_AVER_2ND_RM_TIME=`echo ${ORIG_AVER_2ND_RM_TIME}+${TEMP_READ_TIME}|bc`
+
+	done
+
+	PATCHED_AVER_1ST_TAR_TIME=`echo ${PATCHED_AVER_1ST_TAR_TIME}/${ITERATION}| bc`
+        PATCHED_AVER_1ST_LS_TIME=`echo ${PATCHED_AVER_1ST_LS_TIME}/${ITERATION}| bc`
+        PATCHED_AVER_1ST_RM_TIME=`echo ${PATCHED_AVER_1ST_RM_TIME}/${ITERATION}| bc`
+        PATCHED_AVER_2ND_TAR_TIME=`echo ${PATCHED_AVER_2ND_TAR_TIME}/${ITERATION}| bc`
+        PATCHED_AVER_2ND_LS_TIME=`echo ${PATCHED_AVER_2ND_LS_TIME}/${ITERATION}| bc`
+        PATCHED_AVER_2ND_RM_TIME=`echo ${PATCHED_AVER_2ND_RM_TIME}/${ITERATION}| bc`
+
+        ORIG_AVER_1ST_TAR_TIME=`echo ${ORIG_AVER_1ST_TAR_TIME}/${ITERATION}| bc`
+        ORIG_AVER_1ST_LS_TIME=`echo ${ORIG_AVER_1ST_LS_TIME}/${ITERATION}| bc`
+        ORIG_AVER_1ST_RM_TIME=`echo ${ORIG_AVER_1ST_RM_TIME}/${ITERATION}| bc`
+        ORIG_AVER_2ND_TAR_TIME=`echo ${ORIG_AVER_2ND_TAR_TIME}/${ITERATION}| bc`
+        ORIG_AVER_2ND_LS_TIME=`echo ${ORIG_AVER_2ND_LS_TIME}/${ITERATION}| bc`
+        ORIG_AVER_2ND_RM_TIME=`echo ${ORIG_AVER_2ND_RM_TIME}/${ITERATION}| bc`
+
+	f_LogRunMsg "[Report of patched kernel]\n"
+	f_LogRunMsg "Average 1st Tar Time: ${PATCHED_AVER_1ST_TAR_TIME}s\n"
+	f_LogRunMsg "Average 1st Ls Time: ${PATCHED_AVER_1ST_LS_TIME}s\n"
+	f_LogRunMsg "Average 1st Rm Time: ${PATCHED_AVER_1ST_RM_TIME}s\n"
+	f_LogRunMsg "Average 2nd Tar Time: ${PATCHED_AVER_2ND_TAR_TIME}s\n"
+	f_LogRunMsg "Average 2nd Ls Time: ${PATCHED_AVER_2ND_LS_TIME}s\n"
+	f_LogRunMsg "Average 2nd Rm Time: ${PATCHED_AVER_2ND_RM_TIME}s\n"
+
+	f_LogRunMsg "[Report of original kernel]\n"
+	f_LogRunMsg "Average 1st Tar Time: ${ORIG_AVER_1ST_TAR_TIME}s\n"
+        f_LogRunMsg "Average 1st Ls Time: ${ORIG_AVER_1ST_LS_TIME}s\n"
+        f_LogRunMsg "Average 1st Rm Time: ${ORIG_AVER_1ST_RM_TIME}s\n"
+        f_LogRunMsg "Average 2nd Tar Time: ${ORIG_AVER_2ND_TAR_TIME}s\n"
+        f_LogRunMsg "Average 2nd Ls Time: ${ORIG_AVER_2ND_LS_TIME}s\n"
+        f_LogRunMsg "Average 2nd Rm Time: ${ORIG_AVER_2ND_RM_TIME}s\n"
+
+	return 0
+}
+
+function f_cleanup()
+{
+        :
+}
+
+################################################################################
+# Main Entry
+################################################################################
+
+#redfine the int signal hander
+trap 'echo -ne "\n\n">>${RUN_LOG_FILE};echo  "Interrupted by Ctrl+C,Cleanuping... "|tee -a ${RUN_LOG_FILE}; f_cleanup;exit 1' SIGINT
+
+f_check $*
+
+START_TIME=${SECONDS}
+f_LogRunMsg "=====================Inode alloc perf starts on ${FS_TYPE}:  `date`=====================\n"
+f_LogMsg "=====================Inode alloc perf starts on ${FS_TYPE}:  `date`====================="
+
+f_run_test
+
+END_TIME=${SECONDS}
+f_LogRunMsg "=====================Inode alloc perf testing ends on ${FS_TYPE}: `date`=====================\n"
+f_LogMsg "=====================Inode alloc perf testing ends on ${FS_TYPE}: `date`====================="
+
+f_LogRunMsg "Time elapsed(s): $((${END_TIME}-${START_TIME}))\n"
+f_LogRunMsg "Tests total: $((${ITERATION}*2))\n"
+f_LogRunMsg "Tests passed: ${TEST_PASS}\n"
+
+f_stat_time_consumed
-- 
1.5.5




More information about the Ocfs2-test-devel mailing list