Ejemplo n.º 1
0
    public static void Main(string[] args)
    {
        StreamWriter sw = null;

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("getter-setter-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        GetterSetterTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("getter-setter-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        GetterSetterTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("invoke-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        InvokeTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("invoke-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        InvokeTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("creation-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        CreationTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("creation-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        CreationTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("collection-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        CollectionTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("collection-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        CollectionTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("arithmetic-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ArithmeticTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("arithmetic-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ArithmeticTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("threading-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ThreadingTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("threading-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ThreadingTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("timing-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        TimingTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("timing-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        TimingTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("autoboxing-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        AutoboxingTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("autoboxing-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        AutoboxingTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("file-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        FileTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("file-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        FileTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("exception-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ExceptionTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("exception-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ExceptionTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("recursive-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        RecursiveTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("recursive-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        RecursiveTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("stringconcat-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        StringConcatTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("stringconcat-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        StringConcatTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("nestedloops-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        NestedLoopsTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("nestedloops-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        NestedLoopsTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("heap-sort-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        HeapSortTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("heap-sort-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        HeapSortTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("matrix-multiply-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        MatrixMultiplyTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("matrix-multiply-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        MatrixMultiplyTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("reflection-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ReflectionTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("reflection-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ReflectionTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("enum-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        EnumTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("enum-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        EnumTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("trigo-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        TrigoTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("trigo-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        TrigoTest.main(ARGS);
        sw.Close();


        //TODO NetworkInvoke.main(ARGS);
    }
Ejemplo n.º 2
0
    /**
     * main.
     *
     * @param args
     */
    public static void main(string[] args)
    {
        int nbTests             = (args != null && args.Length >= 1) ? int.Parse(args[0]) : NB_TESTS;
        int nbOfExclusionMinMax = (args != null && args.Length >= 2) ? int.Parse(args[1]) : NB_OF_EXCLUSION_MIN_MAX;

        List <long> executionTimes = new List <long>(nbTests);

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(TrigoTest.testSin());
        }
        executionTimes.Sort();
        Console.WriteLine("[TrigoTest], Calculation of Sin " + NB_ARITHMETIC_TESTS + " while (i < " + TRIG_MAX + ") {sine = Math.Sin(i)     i++ },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(TrigoTest.testCos());
        }
        executionTimes.Sort();
        Console.WriteLine("[TrigoTest], Calculation of Cos " + NB_ARITHMETIC_TESTS + " while (i < " + TRIG_MAX + ") {cosine = Math.Cos(i)     i++ },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(TrigoTest.testTan());
        }
        executionTimes.Sort();
        Console.WriteLine("[TrigoTest], Calculation of Tan " + NB_ARITHMETIC_TESTS + " while (i < " + TRIG_MAX + ") {tan = Math.Tan(i)     i++ },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(TrigoTest.testLog());
        }
        executionTimes.Sort();
        Console.WriteLine("[TrigoTest], Calculation of Log " + NB_ARITHMETIC_TESTS + " while (i < " + TRIG_MAX + ") {log = Math.Log(i)     i++ },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(TrigoTest.testExp());
        }
        executionTimes.Sort();
        Console.WriteLine("[TrigoTest], Calculation of Exp " + NB_ARITHMETIC_TESTS + " while (i < " + TRIG_MAX + ") {exp = Math.Exp(i)     i++ },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(TrigoTest.testSqrt());
        }
        executionTimes.Sort();
        Console.WriteLine("[TrigoTest], Calculation of Sqrt " + NB_ARITHMETIC_TESTS + " while (i < " + TRIG_MAX + ") {sqrt = Math.Sqrt(i)     i++ },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();
    }