summaryrefslogtreecommitdiffstats
path: root/vcpe_beijing/vcpe/pressure
diff options
context:
space:
mode:
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秒"