How can I use a custom timer to measure how long it takes an external process to execute e.g. a Batch file to execute?
To do this use the following code, where ProcessStart calls the external process.
transaction TWeb var hId:Number; begin hId:=ProcessInitialize("c:\\temp.bat",PROCESS_ATTACHED); MeasureStart("BatchFile"); ProcessStart(hId); MeasureStop("BatchFile"); end TWeb;
Note: When setting the process parameters please ensure you use the correct process. The process you use will influence the behavior of the application or batch file and can give you incorrect timings.
The Process_Attached flag will ensure that you measure file or program invocation and execution. However the Process_Detached and Process_Piped will only measure invocation time and not the execution time of the batch file.
For full details on the process flags please see SilkPerformer help on the "ProcessInitialize function"