Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/bash
- #############################################################################
- # File [ TimeMemoryGenerator.sh ]
- # Author [ Swear01 ]
- # Synopsis [ simple test for algorithm PA1 homework format program ]
- # Date [ 2020/10/01 ]
- #############################################################################
- # please ensure your code is right before use this
- # please use this under PA1 folder
- #SIZES = (1000 2000 4000 8000 16000 32000 1000000)
- declare -a SIZES=(1000 2000 4000 8000 16000 32000 1000000)
- declare -a CASE_ORDERS=(2 3 1)
- declare -a METHODS=(IS MS QS RQS HS)
- #init
- make
- echo -n "data," > ram.csv
- echo -n "data," > cpu_time.csv
- for method in "${METHODS[@]}" ; do
- echo -n "$method," >> ram.csv
- echo -n "$method," >> cpu_time.csv
- done
- echo " " >> ram.csv
- echo " " >> cpu_time.csv
- for size in "${SIZES[@]}" ; do
- for case_order in "${CASE_ORDERS[@]}" ; do
- echo -n "$size".case"$case_order," >> cpu_time.csv
- echo -n "$size".case"$case_order," >> ram.csv
- for method in "${METHODS[@]}" ; do
- echo current running -"$method" inputs/"$size".case"$case_order".in
- bin/NTU_sort -"$method" inputs/"$size".case"$case_order".in outputs/"$size".case"$case_order".out > tmp.txt
- #utility/PA1_Result_Checker inputs/"$size".case"$case_order".in outputs/"$size".case"$case_order".out
- nums=($(grep -Eo '[0-9\.]+' tmp.txt))
- echo -n "${nums[0]}," >> cpu_time.csv
- echo -n "${nums[1]}," >> ram.csv
- done
- echo " " >> ram.csv
- echo " " >> cpu_time.csv
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment