Exemple #1
0
        static void Main(string[] args)
        {
            const int maxNumberOfThreads = 50;

            short[] vector = VectorModulusProgram.CreateRandomVector(100000, -10, 10);
            ShowLine(Console.Out, "Numer of Threads", "Ticks", "Result");
            for (int numberOfThreads = 1; numberOfThreads <= maxNumberOfThreads; numberOfThreads++)
            {
                Master   master = new Master(vector, numberOfThreads);
                DateTime before = DateTime.Now;
                double   result = master.ComputeModulus();
                DateTime after  = DateTime.Now;
                ShowLine(Console.Out, numberOfThreads, (after - before).Ticks, result);
                GC.Collect(); // The garbage collector is run
                GC.WaitForFullGCComplete();
            }
        }
 public void Initialize()
 {
     this.vector = VectorModulusProgram.CreateRandomVector(10000, -10, 10);
 }