1
0

combine.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/usr/bin/env bash
  2. #
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. #
  5. # Parametrisation to this script is as follows:
  6. # * none yet
  7. ###
  8. # Preamble
  9. ###
  10. my_path="$(dirname $(readlink -f $0))" || exit $?
  11. readonly my_path
  12. readonly csv_path="$my_path/data"
  13. function cleanup() {
  14. echo OK
  15. }
  16. trap cleanup EXIT
  17. function error_out() {
  18. exit 1
  19. }
  20. trap error_out INT TERM
  21. ###
  22. # Functions
  23. ###
  24. ###
  25. # Implementation
  26. ###
  27. configs=$(find $csv_path -maxdepth 1 -type d -name '*results_*' | sed 's@.*results_@@g') || exit $?
  28. readonly configs
  29. declare -A algos
  30. algos["asym"]="ecc rsa"
  31. algos["hashes"]="sha2 sha3"
  32. algos["mac"]="cmac"
  33. algos["rng"]="rng"
  34. algos["sym"]="cbc ccm gcm"
  35. declare -A headers
  36. headers["asym"]="config,keysize_2,algorithm,keysize,operation,avg ms,ops/sec,"
  37. headers["hashes"]="config,unused,algorithm,MiB/s,"
  38. headers["mac"]="config,unused,algorithm,keysize,MiB/s,"
  39. headers["rng"]="config,unused,algorithm,MiB/s,"
  40. headers["sym"]="config,chunksize,algorithm,blocksize,direction,AAD,MiB/s,"
  41. # "... now you have two problems"
  42. declare -A filters
  43. filters["ccm"]="-e s/-\(enc\|dec\)-\(no_AAD\|custom\)/,128,\1,\2/g -e s/-\(enc\|dec\),/,128,\1,,/g"
  44. filters["gcm"]="-e /-192-/d -e /GMAC/d -e s/-\(enc\|dec\)-\(no_AAD\|custom\)/,\1,\2/g -e s/-\(enc\|dec\),/,\1,default,/g -e s/\(128\|256\)-GCM/GCM,\1/g"
  45. filters["cbc"]="-e /-192-/d -e s/-\(enc\|dec\),/,\1,,/g -e s/\(128\|256\)-CBC/CBC,\1/g"
  46. filters["cmac"]="-e s/\(128\|256\)-CMAC/CMAC,\1/g"
  47. filters["ecc"]='-e 1!{/SECP384R1\|SECP521R1/!d}'
  48. filters["sha2"]="-e s/SHA-/SHA2-/g"
  49. for t in "${!algos[@]}"
  50. do
  51. for algo in ${algos[$t]}
  52. do
  53. outfile="$csv_path/combined_${algo}.csv"
  54. echo ${headers[$t]} > "$outfile"
  55. for cfg in $configs
  56. do
  57. for f in $(find $csv_path/results_${cfg} -name "*${algo}*.csv" | sort -V)
  58. do
  59. sz=$(basename $f | sed -e s/${algo}// -e s/_// -e s/\.csv//)
  60. sz=",$sz"
  61. for l in $(tail -n +2 $f | tr -d ' ')
  62. do
  63. echo "${cfg}${sz},${l}" >> "$outfile"
  64. done
  65. [ "${filters[$algo]}" == "" ] || sed -i "$outfile" ${filters[$algo]}
  66. done
  67. echo $algo $t $cfg
  68. done
  69. done
  70. done