手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>其它>列表

performance test

来源:互联网 作者:西部数码 时间:2008-04-09
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

对软件进行 性能测试,需要写一个脚本来作驱动。

基本要求如下:

(1)每秒钟能并发M次;

(2)可以连续不断地执行N秒;

#需要并发执行的脚本 driver.pl

#每秒并发执行M次的脚本 MperSec.ksh

#! /usr/bin/ksh

# usage: MperSec.ksh M

MperSec= # is how many times per second

time{
for ((i=1;i<=$MperSec;i ))
do
driver.pl & # & means let the script run in background
done

wait

}

#连续执行N秒的脚本 NSecs.ksh

#! /usr/bin/ksh

#usage: NSecs.ksh N M

NSecs=

MperSecond=

for ((i=1;i<=$NSecs;i ))
do
MperSec.ksh& # & means let the script run in background

sleep 1
done

#How to invoke the whole test process

NSecs.ksh 7200 6 |tee test.log

#----------------经过测试的版本----------------------------------

# Solaris 9 ksh

#! /usr/bin/ksh

# usage: MperSec.ksh M

MperSec="" # is how many times per second

function func
{
i=1
while [ "$i" -lt "$MperSec" ]
do
driver.pl & # & means let the script run in background
i=$(($i 1))
done

wait
}

time func
#(time func) 2>&1|awk '/real/{print }'

#! /usr/bin/ksh

# usage: MperSec.ksh M

MperSec="" # is how many times per second

function func
{
i=1
while [ "$i" -lt "$MperSec" ]
do
ipqueryClient.pl & # & means let the script run in background
i=$(($i 1))
done

wait
}

time func

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!