|
集合点,顾名思义,就是虚拟用户在一起集合的点,这就是为我们所谓的并发用户在做准备。
在SilkPerformer中没有直接添加集合点的图标,所以得手工输入代码来添加,用到的主函数为“GlobalWaitFor”,主要使用方法如下:
GlobalWaitFor( in sName : string,
in nCount : number optional,
in nTimeout : number optional ): number;
主要参数如下:
Parameter Description
sName Name to identify the checkpoint
nCount Number of users who must reach or pass the checkpoint (optional). To specify to wait for all users, omit this parameter or specify ALL_USERS.
nTimeout Maximum waiting time in seconds before a timeout occurs (optional). If this parameter is omitted, the timeout is set to INFINITE.
返回值如下:
• GLOBAL_ERROR if an error like an invalid number of users at the checkpoint occurred. To get more information, call the GetLastError function.
• GLOBAL_CANCELED if the waiting period was cancelled by the controller computer.
• GLOBAL_TIMEOUT if the waiting period exceeded the defined timeout and the user continues the simulation.
• GLOBAL_PASSED if all users have reached the checkpoint the user was waiting for and the user continues the simulation.
• GLOBAL_SYNCHRONIZED if all users have reached the checkpoint the user was waiting for. The user was the last one to enter the checkpoint and continues the simulation.
举例如下:
var
hConnection: number;
dcltrans
//定义一个事务
transaction TLogon
var
//定义一个变量来接受返回值
nRet: number;
begin //事务开始
//登录事务执行登录操作
OraLogon(hConnection, "user", "password", "orclnet2");
//添加集合点并返回给nRet
nRet := GlobalWaitFor("All are logged in", ALL_USERS, 300);
//判断返回值是否全部集合完毕
if nRet = GLOBAL_SYNCHRONIZED then
Print("I am the last user at the checkpoint");
end;
//事务结束
end TLogon; |
|