Exemple #1
0
        /// <summary>
        /// </summary>
        public static void Main(string[] args)
        {
            int i = 0;
              int n = 10000;

              if (args.Length>0)
              {
            n = System.Convert.ToInt32(args[0]);
              }

              Kitware.mummy.Runtime.MRSmokeTest test = new Kitware.mummy.Runtime.MRSmokeTest(true);
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Handle: {0}", test.GetCppThis().Handle));
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Wrapper: {0}", test.GetCppThis().Wrapper));

              Kitware.mummy.Runtime.MRSmokeTest testClone = test.Clone();
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("testClone.GetCppThis().Handle: {0}", testClone.GetCppThis().Handle));
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("testClone.GetCppThis().Wrapper: {0}", testClone.GetCppThis().Wrapper));

              // After calling Clone, there should be a valid CreateWrappedObject type index
              // of 0 registered with the mummy.Runtime... Try to create an object and see
              // what we get:
              //
              Kitware.mummy.Runtime.Methods.Trace("create...");
              bool created;
              object obj = Kitware.mummy.Runtime.Methods.CreateWrappedObject(
            // uint status, uint index, uint rawRefCount, System.IntPtr rawCppThis, bool callDisposalMethod
            0, 0, 0, System.IntPtr.Zero, true, out created);
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("obj: {0}", obj));

              test = (Kitware.mummy.Runtime.MRSmokeTest) obj;
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Handle: {0}", test.GetCppThis().Handle));
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Wrapper: {0}", test.GetCppThis().Wrapper));

              // Do it again to verify that the type got cached during the first call to Create...
              //
              obj = Kitware.mummy.Runtime.Methods.CreateWrappedObject(
            0, 0, 0, System.IntPtr.Zero, true, out created);
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("obj: {0}", obj));

              test = (Kitware.mummy.Runtime.MRSmokeTest) obj;
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Handle: {0}", test.GetCppThis().Handle));
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Wrapper: {0}", test.GetCppThis().Wrapper));

              // now loop (like in the other smoke test) the number of times given on
              // the command line so we can compare performance of this create methodology
              // with the performance of a strictly "new-based" strategy...
              //
              for (i= 0; i<n; ++i)
              {
            test = (Kitware.mummy.Runtime.MRSmokeTest)
               Kitware.mummy.Runtime.Methods.CreateWrappedObject(
              0, 0, 0, System.IntPtr.Zero, true, out created);
              }

              test = null;
              testClone = null;

              Kitware.mummy.Runtime.Methods.Trace("about to call System.GC.Collect()...");
              System.GC.Collect();
              Kitware.mummy.Runtime.Methods.Trace("done with System.GC.Collect()...");
        }
Exemple #2
0
        /// <summary>
        /// </summary>
        public static void Main(string[] args)
        {
            int  i            = 0;
            int  n            = 10000;
            bool strong       = false;
            bool evensplit    = false;
            bool pseudorandom = false;

            if (args.Length > 0)
            {
                n = System.Convert.ToInt32(args[0]);
            }

            if (args.Length > 1)
            {
                if ("--strong" == args[1])
                {
                    strong = true;
                }
                else if ("--evensplit" == args[1])
                {
                    evensplit = true;
                }
                else if ("--pseudorandom" == args[1])
                {
                    pseudorandom = true;
                }
            }

            Kitware.mummy.Runtime.MRSmokeTest test      = new Kitware.mummy.Runtime.MRSmokeTest(strong);
            Kitware.mummy.Runtime.MRSmokeTest testClone = test.Clone();

            Kitware.mummy.Runtime.Methods.Trace("looping...");

            for (i = 0; i < args.Length; ++i)
            {
                Kitware.mummy.Runtime.Methods.Trace(System.String.Format("arg{0}: {1}", i, args[i]));
            }

            System.Random r = new System.Random();

            for (i = 0; i < n; ++i)
            {
                if (evensplit)
                {
                    strong = !strong;
                }
                else if (pseudorandom)
                {
                    strong = (r.NextDouble() > 0.5 ? true : false);
                }

                test = new Kitware.mummy.Runtime.MRSmokeTest(strong);
            }

            if (null == testClone)
            {
                throw new System.Exception("error: testClone is null!");
            }

            test      = null;
            testClone = null;

            uint teCount = Kitware.mummy.Runtime.Methods.GetTypeEntryCount();

            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("teCount: {0}", teCount));

            Kitware.mummy.Runtime.Methods.Trace("about to call System.GC.Collect()...");

            System.GC.Collect();

            Kitware.mummy.Runtime.Methods.Trace("done with System.GC.Collect()...");
        }
Exemple #3
0
        /// <summary>
        /// </summary>
        public static void Main(string[] args)
        {
            int i = 0;
            int n = 10000;

            if (args.Length > 0)
            {
                n = System.Convert.ToInt32(args[0]);
            }

            Kitware.mummy.Runtime.MRSmokeTest test = new Kitware.mummy.Runtime.MRSmokeTest(true);
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Handle: {0}", test.GetCppThis().Handle));
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Wrapper: {0}", test.GetCppThis().Wrapper));

            Kitware.mummy.Runtime.MRSmokeTest testClone = test.Clone();
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("testClone.GetCppThis().Handle: {0}", testClone.GetCppThis().Handle));
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("testClone.GetCppThis().Wrapper: {0}", testClone.GetCppThis().Wrapper));

            // After calling Clone, there should be a valid CreateWrappedObject type index
            // of 0 registered with the mummy.Runtime... Try to create an object and see
            // what we get:
            //
            Kitware.mummy.Runtime.Methods.Trace("create...");
            bool   created;
            object obj = Kitware.mummy.Runtime.Methods.CreateWrappedObject(
                // uint status, uint index, uint rawRefCount, System.IntPtr rawCppThis, bool callDisposalMethod
                0, 0, 0, System.IntPtr.Zero, true, out created);

            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("obj: {0}", obj));

            test = (Kitware.mummy.Runtime.MRSmokeTest)obj;
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Handle: {0}", test.GetCppThis().Handle));
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Wrapper: {0}", test.GetCppThis().Wrapper));

            // Do it again to verify that the type got cached during the first call to Create...
            //
            obj = Kitware.mummy.Runtime.Methods.CreateWrappedObject(
                0, 0, 0, System.IntPtr.Zero, true, out created);
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("obj: {0}", obj));

            test = (Kitware.mummy.Runtime.MRSmokeTest)obj;
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Handle: {0}", test.GetCppThis().Handle));
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("test.GetCppThis().Wrapper: {0}", test.GetCppThis().Wrapper));

            // now loop (like in the other smoke test) the number of times given on
            // the command line so we can compare performance of this create methodology
            // with the performance of a strictly "new-based" strategy...
            //
            for (i = 0; i < n; ++i)
            {
                test = (Kitware.mummy.Runtime.MRSmokeTest)
                       Kitware.mummy.Runtime.Methods.CreateWrappedObject(
                    0, 0, 0, System.IntPtr.Zero, true, out created);
            }

            test      = null;
            testClone = null;


            Kitware.mummy.Runtime.Methods.Trace("about to call System.GC.Collect()...");
            System.GC.Collect();
            Kitware.mummy.Runtime.Methods.Trace("done with System.GC.Collect()...");
        }
Exemple #4
0
        /// <summary>
        /// </summary>
        public static void Main(string[] args)
        {
            int i = 0;
              int n = 10000;
              bool strong = false;
              bool evensplit = false;
              bool pseudorandom = false;

              if (args.Length>0)
              {
            n = System.Convert.ToInt32(args[0]);
              }

              if (args.Length>1)
              {
            if ("--strong" == args[1])
            {
              strong = true;
            }
            else if ("--evensplit" == args[1])
            {
              evensplit = true;
            }
            else if ("--pseudorandom" == args[1])
            {
              pseudorandom = true;
            }
              }

              Kitware.mummy.Runtime.MRSmokeTest test = new Kitware.mummy.Runtime.MRSmokeTest(strong);
              Kitware.mummy.Runtime.MRSmokeTest testClone = test.Clone();

              Kitware.mummy.Runtime.Methods.Trace("looping...");

              for (i= 0; i<args.Length; ++i)
              {
            Kitware.mummy.Runtime.Methods.Trace(System.String.Format("arg{0}: {1}", i, args[i]));
              }

              System.Random r = new System.Random();

              for (i= 0; i<n; ++i)
              {
            if (evensplit)
            {
              strong = !strong;
            }
            else if (pseudorandom)
            {
              strong = (r.NextDouble() > 0.5 ? true : false);
            }

            test = new Kitware.mummy.Runtime.MRSmokeTest(strong);
              }

              if (null == testClone)
              {
            throw new System.Exception("error: testClone is null!");
              }

              test = null;
              testClone = null;

              uint teCount = Kitware.mummy.Runtime.Methods.GetTypeEntryCount();
              Kitware.mummy.Runtime.Methods.Trace(System.String.Format("teCount: {0}", teCount));

              Kitware.mummy.Runtime.Methods.Trace("about to call System.GC.Collect()...");

              System.GC.Collect();

              Kitware.mummy.Runtime.Methods.Trace("done with System.GC.Collect()...");
        }