运行已编译的程序20次并汇总结果

时间:2018-08-19 13:27:51

标签: bash unix

我有一个已编译的程序

并使用以下命令运行它:

 /mnt/c/Users/adan/Documents/cht/cache_adapter/cmake-build-debug/cache_adapter -ds 1 map plain

输出为:一个数字

我的目标: 要运行20次并总结所有输出。

我写了这个脚本,但是不起作用:

#!/bin/bash
run_iterations="$1"
if [ "$run_iterations" == "" ]; then
    run_iterations=1
fi
# Write the data structures you would like to run. The options: "map" "unordered_map" "gcc"
 dataStructures="$2"
 #if  [("$dataStructures" != "map") || ("$dataStructures" != "gcc") ||( "$mode" != "unordered_map")];then 
 #  echo wrong ds!
 #  exit 1
  #fi

mode="$3"
 #if  ["$mode" != "plain" || "$mode" != "gcc" || "$mode" != "unordered_map"];then 
 #  echo wrong mode!
 #  exit 1
  #fi
exec_name="release"
size=1000000
numOfElem=500000
workSetSize=250
iterations=10000
numOfWorkSets=10
total_time=0 

for ((i=0; i<1; i++ )); do
run_time= ` /mnt/c/Users/adan/Documents/cht/cache_adapter/cmake-build-debug/cache_adapter -ds 1 map plain|cut -f 5`
echo $run_time
((total_time = total_time +runtime))  
done 

echo $total_time

但是它不起作用,并且始终返回0。

在此感谢您的帮助。

谢谢!

0 个答案:

没有答案