📄 pingtest.cmd
字号:
/*****************************************************************************//* Software Testing Automation Framework (STAF) *//* (C) Copyright IBM Corp. 2001 *//* *//* This software is licensed under the Common Public License (CPL) V1.0. *//*****************************************************************************//*********************************************************************//* Sample5.cmd - Rexx sample program using STAF *//*********************************************************************//* This sample uses the STAF Ping command to ping a STAF client and *//* and measure the throughput. *//* *//* Accepts: [Machine] [LoopCount] [DisplayModulus] *//* *//* Returns: 0, on success *//* >0, if an error is encountered *//*********************************************************************//* Date Who Comment *//* ---------- ------------ --------------------------------------- *//* 03/02/1998 C. Rankin File Created *//*********************************************************************/SIGNAL ON HALT NAME STAFAbortparse arg Machine LoopCount DisplayModulusif (Machine = "?") | (Machine = "/?") | (Machine = "-?") thendo say say "Usage: PingTest [Machine] [LoopCount] [DisplayModulus]" RETURN 1endif Machine = "" then Machine = "LOCAL"if LoopCount = "" then LoopCount = 999999999if DisplayModulus = "" then DisplayModulus = 1000call RxFuncAdd "STAFLoadFuncs", "RXSTAF", "STAFLoadFuncs"call STAFLoadFuncscall STAFRegister "STAF_PING_Test", "STAFHandle"if RESULT \= 0 thendo say "Error registering with STAF, RC:" RESULT RETURN 1endsay TIME() "- Started"startDate = DATE('B')startTime = TIME('S')errors = 0do i=1 to LoopCount call STAFSubmit STAFHandle, Machine, "PING", "PING" if RESULT \= 0 then do errors = errors + 1 say TIME() "- Loop #"i", Error #"errors", RC:" RESULT end else if STAFResult \= "PONG" then do errors = errors + 1 say TIME() "- Loop #"i", Error #"errors", STAFResult =" STAFResult end if i // DisplayModulus = 0 then say TIME() "- Ended Loop #"i", Errors =" errorsendcall AtEndRETURN 0/*********************************************************************//* AtEnd - Unregister from STAF and calculate final PING throughput. *//*********************************************************************/AtEnd: call STAFUnRegister STAFHandle say TIME() "- Ended" endTime = TIME('S') endDate = DATE('B') endSecs = ((endDate - 720000) * 86400) + endTime startSecs = ((startDate - 720000) * 86400) + startTime say "Average:" FORMAT((i / (endSecs - startSecs)), 3, 2) "pings/sec" RETURN 0/*********************************************************************//* STAFAbort - If user aborts, make sure STAF unregister occurs. *//*********************************************************************/STAFAbort: call AtEnd EXIT 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -