首页 > 解决方案 > 运行编译程序 20 次并总结结果

问题描述

我有一个编译好的程序

并使用以下命令运行它:

 /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。

希望能得到一些帮助。

谢谢!

标签: bashunix

解决方案


推荐阅读