Vugen 中的事务和事务实例有什么区别?



我正在使用惠普性能中心的虚拟用户生成器,但我无法弄清楚lr_start/end_transactionlr_startend_transaction_instance之间的区别。我所能找到的支持只是事务用于"跟踪持续时间",事务实例用于"性能分析",但我似乎找不到分析结果的差异。

这两者之间有明显的区别吗?如果是这样,我可以看一个简短的例子吗?

LoadRunner事务用于测量某些语句执行之间的时间。

LoadRunner 事务实例用于对脚本中声明的现有事务进行性能分析。按名称将事务放入一个变量中,该变量稍后可用于分析其状态:获取其当前持续时间、状态等。

例:

long id;
int status;
int amount_overdrawn = get_amount_overdrawn(); // Call some API
while (amount_overdrawn < LIMIT) {    
// Notify that a transaction is starting
lr_start_transaction("withdraw");
status = bank_withdraw(500); // Call some API
// End transaction with operation result - pass or fail
if (status == 0)    
lr_end_transaction("withdraw", LR_PASS);    
else    
lr_end_transaction("withdraw", LR_FAIL);
amount_overdrawn = get_amount_overdrawn();    
}
// Set the transaction instance into a variable    
id = lr_start_transaction_instance("withdraw", 0);
status = bank_withdraw(500);
// End the transaction instance using the same variable 
lr_end_transaction_instance(id, LR_PASS);

最新更新