/// protected override void InputTokenAdded(object sender, IToken token) { StoredTokens.Add(token); ((IPlace)sender).Remove(token); // Start sub engine _engine.Start(); }
private static void ExecuteBenchmark() { // Get number of transitions Console.Write("Executed transitions: "); var transCount = int.Parse(Console.ReadLine()); // Generate Workplan Console.WriteLine(); Console.Write("Generating workplan..."); var workplan = GenerateWorkplan(transCount); Console.WriteLine("done!"); // Prepare benchmarks IWorkflowEngine engine = null; var benchmarks = new[] { new { message = "Creating engine", operation = new Action(() => engine = CreateEngine(workplan)) }, new { message = "Running on default path", operation = new Action(() => { engine.TransitionTriggered += (sender, transition) => { }; engine.Start(); }) }, new { message = "Creating engine", operation = new Action(() => engine = CreateEngine(workplan)) }, new { message = "Running on random path", operation = new Action(() => { engine.TransitionTriggered += FindPath; engine.Start(); }) } }; // Run benchmarks foreach (var benchmark in benchmarks) { Console.Write(benchmark.message + "..."); StopWatch.Restart(); benchmark.operation(); StopWatch.Stop(); Console.WriteLine("done! Elapsed time: {0}ms", StopWatch.ElapsedMilliseconds); } }
static void Main(string[] args) { ComposeModules(); IEnumerable <IWorkflow> workflows = _defaultWorkflowProducer.GetWorkflows(); _defaultWorkflowEngine.Start(workflows); EndProgram(); }