public void RunTests()
        {
            double dResult = 0;

            double[] matrix1 = new double[3 * 1024 * 1024];
            double[] matrix2 = new double[3 * 1024 * 1024];

            //  Run the tests through the pinvoke.
            stopwatch.Restart();
            for (ulong i = 1; i <= testCount; i++)
            {
                TA_IncrementCounter();
            }
            stopwatch.Stop();
            PInvoke_Test1_Time = Math.Round(stopwatch.Elapsed.TotalMilliseconds, 4);

            // Structure with a pointer to another structure.
            MyPerson personName = new MyPerson()
            {
                first = "Mark", last = "Lee"
            };
            MyPerson2 personAll = new MyPerson2()
            {
                age = 35, person = personName
            };

            stopwatch.Restart();
            for (ulong i = 1; i <= testCount; i++)
            {
                IntPtr buffer1 = Marshal.AllocCoTaskMem(Marshal.SizeOf(personAll));
                Marshal.StructureToPtr(personAll, buffer1, false);

                var res = PerformanceTestCore.TestStructInStruct(buffer1);
                DeleteObjectAPI(res);
                Marshal.FreeCoTaskMem(buffer1);
            }
            stopwatch.Stop();
            PInvoke_Test2_Time = Math.Round(stopwatch.Elapsed.TotalMilliseconds, 4);

            dResult = 0;
            stopwatch.Restart();
            for (ulong i = 1; i <= testCount; i++)
            {
                matrix1[0] = i;
                matrix1[1] = i;
                matrix1[2] = i;

                matrix2[0] = i;
                matrix2[1] = i;
                matrix2[2] = i;

                dResult += TA_DotProduct(matrix1, matrix2);
            }
            stopwatch.Stop();
            PInvoke_Test3_Time = Math.Round(stopwatch.Elapsed.TotalMilliseconds, 4);
        }
        public void RunCliTests()
        {
            double dResult;

            //  Create the managed interface.
            ManagedInterface.ManagedInterface managedInterface = new ManagedInterface.ManagedInterface();

            //  Run the tests through the interface.
            stopwatch.Restart();
            for (ulong i = 1; i <= testCount; i++)
            {
                managedInterface.IncrementCounter();
            }
            stopwatch.Stop();
            ManagedInterface_Test1_Time = stopwatch.Elapsed.TotalMilliseconds;

            // Structure with a pointer to another structure.
            MyPerson personName = new MyPerson()
            {
                first = "Mark", last = "Lee"
            };
            MyPerson2 personAll = new MyPerson2()
            {
                age = 35, person = personName
            };

            String res = String.Empty;

            stopwatch.Restart();
            for (ulong i = 1; i <= testCount; i++)
            {
                res = managedInterface.TestStructInStruct(personAll);
            }
            stopwatch.Stop();
            ManagedInterface_Test2_Time = Math.Round(stopwatch.Elapsed.TotalMilliseconds, 4);

            dResult = 0;
            stopwatch.Restart();
            for (ulong i = 1; i <= testCount; i++)
            {
                g_matrix1[0] = i;
                g_matrix1[1] = i;
                g_matrix1[2] = i;

                g_matrix2[0] = i;
                g_matrix2[1] = i;
                g_matrix2[2] = i;

                dResult += managedInterface.DotProduct(g_matrix1, g_matrix2);
            }
            stopwatch.Stop();
            ManagedInterface_Test3_Time = stopwatch.Elapsed.TotalMilliseconds;
        }
 public static extern int TestStructInStruct(ref MyPerson2 person2);