private static void Worker(GenerationMethod generationMethod, ThreadPriority threadPriority) { Common.EnterCriticalSection(Common.LockObject); Common.LeaveCriticalSection(Common.LockObject); GeneratorBase generator = GetGenerator(generationMethod); ThreadTimeStopwatch threadTimeStopwatch = new ThreadTimeStopwatch(); threadTimeStopwatch.Start(); try { generator.Generate(); threadTimeStopwatch.Stop(); WriteResultSummary(generator, threadPriority, threadTimeStopwatch.Elapsed); } finally { Common.WaitForSingleObject(); Common.SevEvent(); } }
private static void WriteResultSummary(GeneratorBase generator, ThreadPriority threadPriority, TimeSpan elapsed) { Logger.Current.WriteLine(string.Empty); string summary = string.Format("{0}; приоритет: {1}; время выполнения: {2} ", generator.MethodName, threadPriority, elapsed); Logger.Current.WriteLine(summary); }
private static void GenerateAndShowNumbers() { foreach (GenerationMethod generationMethod in Enum.GetValues(typeof(GenerationMethod))) { GeneratorBase generator = GetGenerator(generationMethod); generator.Generate(); Logger.Current.WriteLine(generator.MethodName); Logger.Current.WriteLine(); WriteResultArray(generator.ResultArray); Logger.Current.WriteLine(); } }