bash - 运行编译程序 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。
希望能得到一些帮助。
谢谢!
解决方案
推荐阅读
- wpf - Accessing multiple view models
- mysql - MySQL:查找所有多个二级域
- azure - Azure, MVC Core Web App suddenly throw "XmlException: Root element is missing" + "CryptographicException"
- amazon-web-services - AWS SNS 订阅过滤器策略检查消息属性中的键不存在 - 可能吗?
- mysql - mysql - 通过连接表中的搜索标签搜索,按匹配数对结果进行排序并将大多数匹配放在顶部 - 解决方案?
- java - 如何在java / processing中的移动对象内显示文本
- r - 在 R 中解析 GraphQL 输出
- c++ - C++ 中的单链表
- excel - 在 URL 中使用 VBA 激活 Onchange 功能
- c - *初学者 *C 让我对警告感到困惑