Beispiel #1
0
    /**
     * testInvokeOfAStaticMethod.
     *
     * @return
     */
    public static long testInvokeOfAStaticMethodInt()
    {
        int      count = 0;
        DateTime start = DateTime.Now;

        for (int i = NB_INVOKE_TESTS; i != 0; i--)
        {
            count = count + InvokeImpl.echoStatic(i);
        }
        DateTime end           = DateTime.Now;
        TimeSpan executionTime = end - start;

        Console.WriteLine("[InvokeTest], Invoke Of A Static Method int " + NB_INVOKE_TESTS + " InvokeImpl.echoStatic(\"\").Length, count=" + count + ", snapshot time,"
                          + executionTime.TotalMilliseconds);
        return((long)executionTime.TotalMilliseconds);
    }
Beispiel #2
0
    /**
     * testInvokeOfAStaticMethod.
     *
     * @return
     */
    public static long testInvokeOfAStaticMethodString()
    {
        int      count = 0;
        DateTime start = DateTime.Now;

        for (int i = NB_INVOKE_TESTS; i != 0; i--)
        {
            // Write to force jre not to optimize the code
            if (i % 2 == 0)
            {
                count = count + InvokeImpl.echoStatic("1").Length;
            }
            else
            {
                count = count + InvokeImpl.echoStatic("0").Length;
            }
        }
        DateTime end           = DateTime.Now;
        TimeSpan executionTime = end - start;

        Console.WriteLine("[InvokeTest], Invoke Of A Static Method String " + NB_INVOKE_TESTS + " InvokeImpl.echoStatic(i), count=" + count + ", snapshot time,"
                          + executionTime.TotalMilliseconds);
        return((long)executionTime.TotalMilliseconds);
    }