1 Star 0 Fork 0

gavin/f-stack

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
app
doc
dpdk
example
freebsd
lib
mk
tools
.gitignore
.travis.yml
Bandwidth.png
CPS.png
CPS_Reuseport.png
F-Stack.png
LICENSE
README.md
RPS.png
config.ini
start.sh
克隆/下载
start.sh 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
YuYang 提交于 8年前 . notify user to install bc
#!/bin/bash
function usage() {
echo "F-Stack app start tool"
echo "Options:"
echo " -c [conf] Path of config file"
echo " -b [N] Path of binary"
echo " -o [N] Other ARGs for app"
echo " -h show this help"
exit
}
conf=config.ini
bin=./example/helloworld
while getopts "c:b:o:h" args
do
case $args in
c)
conf=$OPTARG
;;
b)
bin=$OPTARG
;;
o)
others=$OPTARG
;;
h)
usage
exit 0
;;
esac
done
if ! type "bc" > /dev/null 2>&1; then
echo "please install bc"
exit
fi
allcmask0x=`cat ${conf}|grep lcore_mask|awk -F '=' '{print $2}'`
((allcmask=16#$allcmask0x))
num_procs=0
PROCESSOR=$(grep 'processor' /proc/cpuinfo |sort |uniq |wc -l)
for((i=0;i<${PROCESSOR};++i))
do
mask=`echo "2^$i"|bc`
((result=${allcmask} & ${mask}))
if [ ${result} != 0 ]
then
((num_procs++));
fi
done
for((proc_id=0; proc_id<${num_procs}; ++proc_id))
do
if ((proc_id == 0))
then
echo "${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} ${others}"
${bin} --conf ${conf} --proc-type=primary --proc-id=${proc_id} ${others} &
sleep 5
else
echo "${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} ${others}"
${bin} --conf ${conf} --proc-type=secondary --proc-id=${proc_id} ${others} &
fi
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gavin321/f-stack.git
git@gitee.com:gavin321/f-stack.git
gavin321
f-stack
f-stack
master

搜索帮助