static void OneCallTest_TestManagedWorker() { Console.WriteLine("One call - Managed worker (P/Invoke) test:"); using (ManagedWorker worker = new ManagedWorker()) { Console.Write("Starting..."); worker.Start(); worker.QueueDemoWorkerTasks(); worker.Stop(); Console.WriteLine(" - Finished."); worker.PrintStatistics(); _managedWorkerWorkingSeconds.Add(worker.GetWorkingSeconds()); } }
static void MultipleSyncCallsTest_TestManagedWorker() { Console.WriteLine("Synchronous calls - Managed worker (P/Invoke) test:"); using (ManagedWorker worker = new ManagedWorker()) { Console.Write("Starting..."); worker.Start(); Parallel.ForEach(_tasksLoopCounts, t => { worker.ExecuteWorkerTask(t, t); }); worker.Stop(); Console.WriteLine(" - Finished."); worker.PrintStatistics(); _managedWorkerWorkingSeconds.Add(worker.GetWorkingSeconds()); } }
static void MultipleCallsTest_TestManagedWorker() { Console.WriteLine("Multiple calls - Managed worker (P/Invoke) test:"); using (ManagedWorker worker = new ManagedWorker()) { Console.Write("Starting..."); worker.Start(); foreach (uint taskLoopCount in _tasksLoopCounts) { worker.QueueWorkerTask(taskLoopCount, taskLoopCount); } worker.Stop(); Console.WriteLine(" - Finished."); worker.PrintStatistics(); _managedWorkerWorkingSeconds.Add(worker.GetWorkingSeconds()); } }