//Method to execute the specified flow a specified number of times. public void StartFlowExecution() { //Register the user using (UserContextHolder.Register(_userContext)) { //Create a stopwatch and kick it off, logging a guid to identify the batch of flow runs string threadExecutionId = System.Guid.NewGuid().ToString(); Stopwatch outerStopWatch = new Stopwatch(); Log.Error("Starting Thread: " + threadExecutionId + ", number of executions: " + _executions + ",flow: " + _flowId); outerStopWatch.Start(); //Kick off the specified flow executions with the Flow Engine for (int i = 0; i < _executions; i++) { //Create a stopwatch and kick it off, logging a guid to identify the individual flow run string flowExecutionId = System.Guid.NewGuid().ToString(); Stopwatch innerStopWatch = new Stopwatch(); Log.Error("Starting Flow Run: " + flowExecutionId); innerStopWatch.Start(); //Execute the flow with canned data FlowEngine.StartSyncFlow(FlowEngine.GetFlow(_flowId), GetFlowStateData()); //Stop the stopwatch and log how much time it took for the individual flow run innerStopWatch.Stop(); Log.Error("Flow Run " + flowExecutionId + " took: " + innerStopWatch.Elapsed.TotalMilliseconds + " milliseconds."); } //Stop the stopwatch and log how much time it took for the batch of flow runs outerStopWatch.Stop(); Log.Error("Thread: " + threadExecutionId + ", number of executions: " + _executions + ",flow: " + _flowId + ", took " + outerStopWatch.Elapsed.TotalSeconds + " seconds."); } }