Пример #1
0
        public static void Main(string[] args)
        {
            try
            {
                System.TimeSpan ts;
                System.DateTime begin;

                Trace("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)\n");
                Trace("Begin ManualTestPerformance.Main\n");

                Vehicle v1 = new Vehicle();

                uint i    = 0;
                uint maxi = 2999006;//v1.GetMaxIndex();

                Trace("Set/GetValue loop...\n");
                begin = System.DateTime.Now;
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetValue(i, v1.TGetValue(i + 1));
                }
                ts = System.DateTime.Now - begin;
                ReportTiming("int", ts, maxi);

                Trace("Set/GetDoubleValue loop...\n");
                begin = System.DateTime.Now;
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetDoubleValue(i, v1.TGetDoubleValue(i + 1));
                }
                ts = System.DateTime.Now - begin;
                ReportTiming("double", ts, maxi);

                Trace("Set/GetStringValue loop...\n");
                begin = System.DateTime.Now;
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetStringValue(i, v1.TGetStringValue(i + 1));
                }
                ts = System.DateTime.Now - begin;
                ReportTiming("string", ts, maxi);

                Trace("Set/GetObjectValue loop...\n");
                begin = System.DateTime.Now;
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetObjectValue(i, v1.TGetObjectValue(i + 1));
                }
                ts = System.DateTime.Now - begin;
                ReportTiming("object", ts, maxi);

                Trace("End ManualTestPerformance.Main\n");
            }
            catch (Exception exc)
            {
                Trace(exc.ToString());
                throw;
            }
        }
Пример #2
0
        public static void Main(string[] args)
        {
            try
              {
            System.TimeSpan ts;
            System.DateTime begin;

            Trace("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)\n");
            Trace("Begin ManualTestPerformance.Main\n");

            Vehicle v1 = new Vehicle();

            uint i = 0;
            uint maxi = 2999006;//v1.GetMaxIndex();

            Trace("Set/GetValue loop...\n");
            begin = System.DateTime.Now;
            for (i= 0; i<maxi; ++i)
              {
              v1.TSetValue(i, v1.TGetValue(i+1));
              }
            ts = System.DateTime.Now - begin;
            ReportTiming("int", ts, maxi);

            Trace("Set/GetDoubleValue loop...\n");
            begin = System.DateTime.Now;
            for (i = 0; i < maxi; ++i)
              {
              v1.TSetDoubleValue(i, v1.TGetDoubleValue(i+1));
              }
            ts = System.DateTime.Now - begin;
            ReportTiming("double", ts, maxi);

            Trace("Set/GetStringValue loop...\n");
            begin = System.DateTime.Now;
            for (i = 0; i < maxi; ++i)
              {
              v1.TSetStringValue(i, v1.TGetStringValue(i+1));
              }
            ts = System.DateTime.Now - begin;
            ReportTiming("string", ts, maxi);

            Trace("Set/GetObjectValue loop...\n");
            begin = System.DateTime.Now;
            for (i = 0; i < maxi; ++i)
              {
              v1.TSetObjectValue(i, v1.TGetObjectValue(i+1));
              }
            ts = System.DateTime.Now - begin;
            ReportTiming("object", ts, maxi);

            Trace("End ManualTestPerformance.Main\n");
              }
              catch(Exception exc)
              {
            Trace(exc.ToString());
            throw;
              }
        }
Пример #3
0
        public virtual void VirtualMain(string[] args)
        {
            try
              {
            Trace("Begin ManualTestCallback.Main\n");

            Vehicle v1 = new Vehicle();
            GCHandle gch = GCHandle.Alloc(this);

            Trace(String.Format("v1: {0:x}\n", (uint) v1.GetCppThis().Handle));
            //Trace(String.Format("cb: {0}\n", cb == null ? "(null)" : cb.ToString()));

            uint i = 0;
            uint maxi = 1999005;//v1.GetMaxIndex();

            Trace("Set/GetValue loop...\n");
            //v1.SetCallback(cb, gch);
            for (i= 0; i<maxi; ++i)
              {
              v1.TSetValue(i, v1.TGetValue(i+1));
              if (0 == i)
            {
            //v1.SetCallback(null, gch);
            }
              }
            Trace(String.Format("  i: {0}\n", i));

            Trace("Set/GetDoubleValue loop...\n");
            //v1.SetCallback(cb, gch);
            for (i = 0; i < maxi; ++i)
              {
              v1.TSetDoubleValue(i, v1.TGetDoubleValue(i+1));
              if (0 == i)
            {
            //v1.SetCallback(null, gch);
            }
              }
            Trace(String.Format("  i: {0}\n", i));

            Trace("Set/GetStringValue loop...\n");
            //v1.SetCallback(cb, gch);
            for (i = 0; i < maxi; ++i)
              {
              v1.TSetStringValue(i, v1.TGetStringValue(i+1));
              if (0 == i)
            {
            //v1.SetCallback(null, gch);
            }
              }
            Trace(String.Format("  i: {0}\n", i));

            Trace("Set/GetObjectValue loop...\n");
            //v1.SetCallback(cb, gch);
            for (i = 0; i < maxi; ++i)
              {
              v1.TSetObjectValue(i, v1.TGetObjectValue(i+1));
              if (0 == i)
            {
            //v1.SetCallback(null, gch);
            }
              }
            Trace(String.Format("  i: {0}\n", i));

            Trace("MethodWithBoolRefArg loop...\n");
            for (i = 0; i < 30; ++i)
              {
              byte arg = 0;
              v1.MethodWithBoolRefArg(ref arg);
              Trace(String.Format("  i: {0}  --  arg: \n", i, (arg != 0 ? "true" : "false")));
              }
            Trace(String.Format("  i: {0}\n", i));

            gch.Free();

            Trace("End ManualTestCallback.Main\n");
              }
              catch(Exception exc)
              {
            Trace(exc.ToString());
            throw;
              }
        }
Пример #4
0
        public virtual void VirtualMain(string[] args)
        {
            try
            {
                Trace("Begin ManualTestCallback.Main\n");

                Vehicle  v1  = new Vehicle();
                GCHandle gch = GCHandle.Alloc(this);

                Trace(String.Format("v1: {0:x}\n", (uint)v1.GetCppThis().Handle));
                //Trace(String.Format("cb: {0}\n", cb == null ? "(null)" : cb.ToString()));

                uint i    = 0;
                uint maxi = 1999005;//v1.GetMaxIndex();

                Trace("Set/GetValue loop...\n");
                //v1.SetCallback(cb, gch);
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetValue(i, v1.TGetValue(i + 1));
                    if (0 == i)
                    {
                        //v1.SetCallback(null, gch);
                    }
                }
                Trace(String.Format("  i: {0}\n", i));

                Trace("Set/GetDoubleValue loop...\n");
                //v1.SetCallback(cb, gch);
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetDoubleValue(i, v1.TGetDoubleValue(i + 1));
                    if (0 == i)
                    {
                        //v1.SetCallback(null, gch);
                    }
                }
                Trace(String.Format("  i: {0}\n", i));

                Trace("Set/GetStringValue loop...\n");
                //v1.SetCallback(cb, gch);
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetStringValue(i, v1.TGetStringValue(i + 1));
                    if (0 == i)
                    {
                        //v1.SetCallback(null, gch);
                    }
                }
                Trace(String.Format("  i: {0}\n", i));

                Trace("Set/GetObjectValue loop...\n");
                //v1.SetCallback(cb, gch);
                for (i = 0; i < maxi; ++i)
                {
                    v1.TSetObjectValue(i, v1.TGetObjectValue(i + 1));
                    if (0 == i)
                    {
                        //v1.SetCallback(null, gch);
                    }
                }
                Trace(String.Format("  i: {0}\n", i));

                Trace("MethodWithBoolRefArg loop...\n");
                for (i = 0; i < 30; ++i)
                {
                    byte arg = 0;
                    v1.MethodWithBoolRefArg(ref arg);
                    Trace(String.Format("  i: {0}  --  arg: \n", i, (arg != 0 ? "true" : "false")));
                }
                Trace(String.Format("  i: {0}\n", i));

                gch.Free();

                Trace("End ManualTestCallback.Main\n");
            }
            catch (Exception exc)
            {
                Trace(exc.ToString());
                throw;
            }
        }