Last active
January 5, 2021 09:40
-
-
Save KingofHamyang/a4dea807ee3fb4a95c3884665a5f4729 to your computer and use it in GitHub Desktop.
Code to parse benchmark result data into several forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# root path for your raw data | |
root_path=../data_example/result/performance | |
# output dir for parsed data files | |
output_path=../data_example/parsed_data | |
# before run, delete old files | |
rm -rf $output_path | |
mkdir ../data_example/parsed_data | |
# Checking how many types of File Systems | |
FILE_SYSTEMS=() | |
for fs in `ls $root_path`; do | |
FILE_SYSTEMS+=($fs) | |
done | |
# Checking how many types of deivces | |
DEVICES_TYPES=() | |
for dt in `ls "$root_path/${FILE_SYSTEMS[1]}"`; do | |
DEVICES_TYPES+=($dt) | |
done | |
#make headers | |
HEADER=("#") | |
for fs in ${FILE_SYSTEMS[@]}; do | |
HEADER+=($fs) | |
done | |
# dir architecture , File_systems/device_types/each_data_file -> device_types/combined_data_file | |
# check number of data file we have to read | |
NUM_OF_EXPER=`ls -l "$root_path/${FILE_SYSTEMS[1]}/${DEVICES_TYPES[1]}"| grep ^- | wc -l` | |
# for each devices type | |
for dt in ${DEVICES_TYPES[@]}; do | |
#define write buffer for each lines | |
write_data_buff=() | |
#write header | |
printf "%3s" "#" >> "$output_path/$dt.dat" | |
for head in ${FILE_SYSTEMS[@]}; do | |
printf "%16s" $head >> "$output_path/$dt.dat" | |
done | |
printf "\n" >> "$output_path/$dt.dat" | |
# for each data files | |
for ((i=0; i< $NUM_OF_EXPER; i++ )); do | |
#write ops of each file systems into 1 raw in the file | |
for fs in ${FILE_SYSTEMS[@]}; do | |
file_path="$root_path/$fs/$dt" | |
file_name=($(ls $file_path)) | |
ops=`cat "$file_path/${file_name[$i]}" | grep "IO Summary" | awk '{print $6}'` | |
exper_num=`echo ${file_name[$i]} | sed 's/[^0-9]//g'` | |
write_data_buff+=($exper_num) | |
write_data_buff+=($ops) | |
done | |
printf "%3s" "${write_data_buff[0]}" >> "$output_path/$dt.dat" | |
printf "%16f" ${write_data_buff[1]} >> "$output_path/$dt.dat" | |
printf "%16f\n" ${write_data_buff[3]} >> "$output_path/$dt.dat" | |
# initialized the write buff | |
write_data_buff=() | |
done | |
done | |
# sort lines order by exper file number | |
for dt in ${DEVICES_TYPES[@]}; do | |
sort "$output_path/$dt.dat" -o "$output_path/$dt.dat" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment