AdvancedMultithreadingLab.MiscBenchmarks.TestUncontented C# (CSharp) Метод

TestUncontented() приватный статический Метод

private static TestUncontented ( ) : void
Результат void
        private static void TestUncontented()
        {
            const int n = 100000000;

            Stopwatch stopwatch = Stopwatch.StartNew();
            for ( int i = 0; i < n; i++ )
            {
                Monitor.Enter( sync );
                Monitor.Exit( sync );
            }
            stopwatch.Stop();

            WriteTime("Uncontended lock", n, stopwatch.ElapsedTicks);
        }