$PRS^f
J\0最近研究一个开源的性能测试功能openSTA,网上资源确实太少,刚巧最近工作留给我的时间很少。51Testing软件测试网7Q^0{F,D^.Y
*FA2IW3V!Mn0今天无奈的我,还是逼自己静下心看Help文档了。有点小成果,赶紧记下来。51Testing软件测试网9J9vc"u|]i
[Lq sVC;\nL0将下面代码复制到 scrīpt Modeler 中,在Commander里运行,查看其Test Report Log。51Testing软件测试网i;?"il4O&dk
51Testing软件测试网:H}
M2_8Ej!***************************代码头***************************!
QF'mHDl8eC:p7gg0Environment !1
Descrīption "" !2
Definitions !3
iNTEGER i (1-100), scrīpt !4
integer m,local !5
code !6
report "m=",m !7
ACQUIRE MUTEX "first" !8
next i !9
set m = i !10
report "m=",m !11
RELEASE MUTEX "first" !12
report "m=",m !13
51Testing软件测试网 z(NR(z0}A4lc!***************************代码尾***************************!51Testing软件测试网Y!L"ptotb
51Testing软件测试网ex4X[
j;dY;]51Testing软件测试网4]"Am|^y
51Testing软件测试网S%wXV#Y此脚本虽小,且简单,但你确可从中明白openSTA的一些实现过程。51Testing软件测试网RJY$~yJ8w7W6V8~
3u&S-RZz/F-WzQ0一、从UserID你可以知道,并发的三个用户,开始运行是没有先后顺序的。51Testing软件测试网h+Y@$E-fNW\
51Testing软件测试网A6}3U`d U二、从Line#你可以知道,代码7行处的m一直等于0,代码11行、13行都是从1递增。
z4O2epP+^Qy051Testing软件测试网/ux9WM ?(m;Dk{三、给我留下了一个疑点,ACQUIRE MUTEX 、RELEASE MUTEX 的作用和区别。51Testing软件测试网^6dIS9rg
Help文档描述如下:
51Testing软件测试网6A_D-R1lACQUIRE MUTEX Command
51Testing软件测试网+t+L,Z;~Bn.B9_xThis command acquires exclusive access to a shared resource, known as a mutex. The mutex is identified by its name and scope (which must be either LOCAL or TEST-WIDE). A test-wide mutex is one that is shared by all scrīpts running as part of a distributed test; a local mutex is only shared between scrīpts running on the local node.
;?!J)R`u;po4z+jh4j3^0RELEASE MUTEX Command
51Testing软件测试网S L7i5{
UovThis command releases a named mutex. The mutex to be released is identified by its name and scope, which must correspond to the values specified on the corresponding ACQUIRE MUTEX command.
\vM
p
p R}u7I0看着这翻译和我的理解,结合这结果,让我很不理解
)])mo-S1NrbH0