summaryrefslogtreecommitdiffstats
path: root/vcpe_beijing/vcpe/pressure
diff options
context:
space:
mode:
authorhuangzh <huangzh.bri@chinatelecom.cn>2018-11-07 11:45:38 +0800
committerhuangzh <huangzh.bri@chinatelecom.cn>2018-11-08 10:57:13 +0800
commit1ff97d639e631fe7465038d76e093bc5c1a31867 (patch)
treed3f4aa2144043930c2fee7073a22e45a9f41805b /vcpe_beijing/vcpe/pressure
parent4d96698b0cc2b738685482c8a8971f21b143b27e (diff)
new add s3p test scripte
Change-Id: I84b933c017ad7cee12e70da868e8dea1dd9f348b Issue-ID: INT-714 Signed-off-by: huangzh <huangzh.bri@chinatelecom.cn>
Diffstat (limited to 'vcpe_beijing/vcpe/pressure')
-rw-r--r--vcpe_beijing/vcpe/pressure/.test.sh.swpbin0 -> 12288 bytes
-rw-r--r--vcpe_beijing/vcpe/pressure/control.sh25
-rw-r--r--vcpe_beijing/vcpe/pressure/echo.sh9
-rw-r--r--vcpe_beijing/vcpe/pressure/test.sh26
4 files changed, 60 insertions, 0 deletions
diff --git a/vcpe_beijing/vcpe/pressure/.test.sh.swp b/vcpe_beijing/vcpe/pressure/.test.sh.swp
new file mode 100644
index 0000000..d5704e1
--- /dev/null
+++ b/vcpe_beijing/vcpe/pressure/.test.sh.swp
Binary files differ
diff --git a/vcpe_beijing/vcpe/pressure/control.sh b/vcpe_beijing/vcpe/pressure/control.sh
new file mode 100644
index 0000000..65c9bc4
--- /dev/null
+++ b/vcpe_beijing/vcpe/pressure/control.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+start_time=`date +%s` #定义脚本运行的开始时间
+[ -e /tmp/fd1 ] || mkfifo /tmp/fd1 #创建有名管道
+exec 3<>/tmp/fd1 #创建文件描述符,以可读(<)可写(>)的方式关联管道文件,这时候文件描述符3就有了有名管道文件的所有特性
+rm -rf /tmp/fd1 #关联后的文件描述符拥有管道文件的所有特性,所以这时候管道文件可以删除,我们留下文件描述符来用就可以了
+for ((i=1;i<=1000;i++))
+do
+ echo >&3 #&3代表引用文件描述符3,这条命令代表往管道里面放入了一个"令牌"
+done
+
+for ((i=1;i<=10000;i++))
+do
+read -u3 #代表从管道中读取一个令牌
+{
+ echo 'success'$i &
+ echo >&3 #代表我这一次命令执行到最后,把令牌放回管道
+}&
+done
+wait
+
+stop_time=`date +%s` #定义脚本运行的结束时间
+
+echo "TIME:`expr $stop_time - $start_time`"
+exec 3<&- #关闭文件描述符的读
+exec 3>&- #关闭文件描述符的写
diff --git a/vcpe_beijing/vcpe/pressure/echo.sh b/vcpe_beijing/vcpe/pressure/echo.sh
new file mode 100644
index 0000000..96489f2
--- /dev/null
+++ b/vcpe_beijing/vcpe/pressure/echo.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+python /home/ubuntu/autotest/vcpe.py init
+
+#python /home/ubuntu/autotest/vcpe.py brg
+
+#python /home/ubuntu/autotest/vcpe.py customer
+
+#python /home/ubuntu/autotest/vcpe.py loop
diff --git a/vcpe_beijing/vcpe/pressure/test.sh b/vcpe_beijing/vcpe/pressure/test.sh
new file mode 100644
index 0000000..367db10
--- /dev/null
+++ b/vcpe_beijing/vcpe/pressure/test.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#开始时间
+begin=$(date +%s)
+
+count=4
+rsnum=1
+cishu=$(expr $count / $rsnum)
+
+for ((i=0; i<$cishu;))
+do
+ start_num=$(expr $i \* $rsnum + 1)
+ end_num=$(expr $start_num + $rsnum - 1)
+ for j in `seq $start_num $end_num`
+ do
+ #echo $j
+ ./echo.sh &
+ done
+ wait
+ i=$(expr $i + 1)
+done
+
+#结束时间
+end=$(date +%s)
+spend=$(expr $end - $begin)
+echo "花费时间为$spend秒"