Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #### xctb.sh
- #### XCTB - X Compression Tool Benchmarker
- #
- #### included compressor :
- # pigz gzip bzip2 pbzip2 lrzip rzip64 zstd pixz plzip xz
- #
- # apt-get install -y pigz gzip bzip2 pbzip2 lrzip rzip zstd pixz plzip
- #
- #######
- set -x
- result=x_benchmark.csv
- source=$1
- compressor_list=("pigz -f" "gzip -f" "bzip2 -f" "pbzip2 -f" "lrzip -f -D" "rzip -f" "zstd -f --rm" "pixz " "plzip -f" "xz -f")
- ext_file=("gz" "gz" "bz2" "bz2" "lrz" "rz" "zst" "xz" "lz" "xz")
- # clean slate
- rm $result
- i=0
- echo \"Compression Tool\",\"Compress Time \(sec\)\",\"Compress Size \(MB\)\",\"Decompress Time \(sec\)\" >> $result
- for compress in "${compressor_list[@]}"
- do
- #### testing compression
- echo '\r\r Testing compression tool : $compress \r'
- #### record compression time
- start=`date +%s`
- $compress $source
- end=`date +%s`
- compress_time=$((end-start))
- #### record compression size
- compress_size=$(ls -s --block-size=M $source.* | cut -f1 -d "M")
- #### record decompression time
- start=`date +%s`
- $compress -d $source.${ext_file[$i]}
- end=`date +%s`
- decompress_time=$((end-start))
- echo \"$compress\",\"$compress_time\",\"$compress_size\",\"$decompress_time\" >> $result
- ((i=i+1))
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement