Skip to content

Instantly share code, notes, and snippets.

@KingofHamyang
Created January 15, 2021 12:10
Show Gist options
  • Save KingofHamyang/ffe50587fe20a743b2b20186c12854df to your computer and use it in GitHub Desktop.
Save KingofHamyang/ffe50587fe20a743b2b20186c12854df to your computer and use it in GitHub Desktop.
parsing_mobibench_result.sh
#!/bin/bash
FILE_SYSTEMS=("ext4" "xfs" "f2fs") # file systems
WRITE_TYPE=(0 1 4) # option for write pattern, 0=sequential, 1=random, 4=append
SYNC_TYPE=(8 8 2) # option for sync type, 8=fdatsync and 2=fsync
BENCHMARK_WORKING_DIR=/home/haseongjun/workspace # mobibench writing path
file_size=5242880 # 5242880KB = 5GB
# remove old result data
rm ./output/result.dat
for fs in ${FILE_SYSTEMS[@]}; do
# setupt filesystem with device umount -> format -> mount
umount /dev/sda6 1>/dev/null
if [ $fs == ext4 ]; then
yes | mkfs -t $fs /dev/sda6 1>/dev/null
else
mkfs.$fs -f /dev/sda6 1>/dev/null
fi
mount /dev/sda6 $BENCHMARK_WORKING_DIR 1>/dev/null
printf "%8s" "$fs" >> "./output/result.dat"
for((i=0; i<3; i++)); do
kb_per_sec=`./mobibench -p $BENCHMARK_WORKING_DIR -f $file_size -a ${WRITE_TYPE[$i]} -y ${SYNC_TYPE[$i]} | awk '/[TIME]/ {print $8}'`
printf "%16f" "$kb_per_sec" >> "./output/result.dat"
printf " KB/sec" >> "./output/result.dat"
done
printf "\n" >> "./output/result.dat"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment