Example #1
0
    /**
     * testInvokeOfAnInstanceMethodWithSetInstanceVariableWithoutInterface.
     *
     * @return
     */
    public static long testInvokeOfAnInstanceMethodWithSetInstanceVariableWithoutInterfaceWithReflection()
    {
        int count = 0;
        ReflectionInvokeImpl reflectionInvokeImpl = new ReflectionInvokeImpl();
        Type type = reflectionInvokeImpl.GetType();

        object[] arguments = new object[] { "1" };
        DateTime start     = DateTime.Now;

        for (int i = NB_INSTANCE_REFLECTION_TESTS; i != 0; i--)
        {
            String s = (String)type.InvokeMember("echoWithSetVariable",
                                                 BindingFlags.InvokeMethod,
                                                 null,
                                                 reflectionInvokeImpl,
                                                 arguments);

            count = count + s.Length;
        }
        DateTime end           = DateTime.Now;
        TimeSpan executionTime = end - start;

        Console.WriteLine("[ReflectionTest], Invoke Of An Instance Method With Set Instance Variable Without Interface With Reflection " + NB_INSTANCE_REFLECTION_TESTS + " invoke.echoWithSetVariable(\"1\").length()  , count=" + count + ", snapshot time,"
                          + executionTime.TotalMilliseconds);
        return((long)executionTime.TotalMilliseconds);
    }
Example #2
0
    /**
     * testInvokeOfAStaticMethod.
     *
     * @return
     */
    public static long testInvokeOfAStaticMethod()
    {
        int      count = 0;
        DateTime start = DateTime.Now;

        for (int i = NB_STATIC_REFLECTION_TESTS; i != 0; i--)
        {
            count = count + ReflectionInvokeImpl.echoStatic("1").Length;
        }
        DateTime end           = DateTime.Now;
        TimeSpan executionTime = end - start;

        Console.WriteLine("[ReflectionTest], Invoke Of A Static Method " + NB_STATIC_REFLECTION_TESTS + " ReflectionInvokeImpl.echoStatic(\"\").length(), count=" + count + ", snapshot time,"
                          + executionTime.TotalMilliseconds);
        return((long)executionTime.TotalMilliseconds);
    }
Example #3
0
    /**
     * testInvokeOfAnInstanceMethodWithSetInstanceVariableWithoutInterface.
     *
     * @return
     */
    public static long testInvokeOfAnInstanceMethodWithGetInstanceVariableWithoutInterface()
    {
        int count = 0;
        ReflectionInvokeImpl invoke = new ReflectionInvokeImpl();
        DateTime             start  = DateTime.Now;

        for (int i = NB_INSTANCE_REFLECTION_TESTS; i != 0; i--)
        {
            count = count + invoke.echoWithGetVariable().Length;
        }
        DateTime end           = DateTime.Now;
        TimeSpan executionTime = end - start;

        Console.WriteLine("[ReflectionTest], Invoke Of An Instance Method With Get Instance Variable Without Interface " + NB_INSTANCE_REFLECTION_TESTS + " invoke.echoWithGetVariable().length()  , count=" + count + ", snapshot time,"
                          + executionTime.TotalMilliseconds);
        return((long)executionTime.TotalMilliseconds);
    }
    /**
     * testInvokeOfAStaticMethod.
     *
     * @return
     */
    public static long testInvokeOfAStaticMethodWithReflection()
    {
        int count = 0;
        ReflectionInvokeImpl reflectionInvokeImpl = new ReflectionInvokeImpl();
        Type type = reflectionInvokeImpl.GetType();
        object[] arguments = new object[] { "1" };
        DateTime start = DateTime.Now;
        for (int i = NB_STATIC_REFLECTION_TESTS; i != 0; i--)
        {
            String s = (String)type.InvokeMember("echoStatic",
                             BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod,
                             null,
                             reflectionInvokeImpl,
                             arguments);

            count = count + s.Length;
        }
        DateTime end = DateTime.Now;
        TimeSpan executionTime = end - start;

        Console.WriteLine("[ReflectionTest], Invoke Of A Static Method With Reflection " + NB_STATIC_REFLECTION_TESTS + " ReflectionInvokeImpl.echoStatic(\"\").length(), count=" + count + ", snapshot time,"
            + executionTime.TotalMilliseconds);
        return (long) executionTime.TotalMilliseconds;
    }
    /**
     * testInvokeOfAnInstanceMethodWithSetInstanceVariableWithoutInterface.
     *
     * @return
     */
    public static long testInvokeOfAnInstanceMethodWithGetInstanceVariableWithoutInterfaceWithReflection()
    {
        int count = 0;
        ReflectionInvokeImpl reflectionInvokeImpl = new ReflectionInvokeImpl();
        Type type = reflectionInvokeImpl.GetType();
        object[] arguments = new object[] {};
        DateTime start = DateTime.Now;
        for (int i = NB_INSTANCE_REFLECTION_TESTS; i != 0; i--)
        {
            String s = (String)type.InvokeMember("echoWithGetVariable",
                             BindingFlags.InvokeMethod,
                             null,
                             reflectionInvokeImpl,
                             arguments);

            count = count + s.Length;
        }
        DateTime end = DateTime.Now;
        TimeSpan executionTime = end - start;
        Console.WriteLine("[ReflectionTest], Invoke Of An Instance Method With Set Instance Variable Without Interface With Reflection " + NB_INSTANCE_REFLECTION_TESTS + " invoke.echoWithSetVariable(\"1\").length()  , count=" + count + ", snapshot time,"
            + executionTime.TotalMilliseconds);
        return (long)executionTime.TotalMilliseconds;
    }
 /**
  * testInvokeOfAnInstanceMethodWithSetInstanceVariableWithoutInterface.
  *
  * @return
  */
 public static long testInvokeOfAnInstanceMethodWithGetInstanceVariableWithoutInterface()
 {
     int count = 0;
     ReflectionInvokeImpl invoke = new ReflectionInvokeImpl();
     DateTime start = DateTime.Now;
     for (int i = NB_INSTANCE_REFLECTION_TESTS; i != 0; i--)
     {
         count = count + invoke.echoWithGetVariable().Length;
     }
     DateTime end = DateTime.Now;
     TimeSpan executionTime = end - start;
     Console.WriteLine("[ReflectionTest], Invoke Of An Instance Method With Get Instance Variable Without Interface " + NB_INSTANCE_REFLECTION_TESTS + " invoke.echoWithGetVariable().length()  , count=" + count + ", snapshot time,"
         + executionTime.TotalMilliseconds);
     return (long)executionTime.TotalMilliseconds;
 }