コード例 #1
0
 /// <summary>
 /// To measure things accurately we spawn a new process for every serializer and then create for 4 different types a serializer where some data is serialized
 /// </summary>
 private void FirstCall()
 {
     if (StartupSerializersToTest.Count == StartupSerializerCount) // we always create 4 serializer with different types for startup tests
     {
         var tester = new Test_O_N_Behavior(StartupSerializersToTest);
         tester.TestSerialize(new int[] { 1 }, nRuns: 1);
     }
     else
     {
         for (int i = 0; i < StartupSerializersToTest.Count; i += StartupSerializerCount)
         {
             var serializer = StartupSerializersToTest[i];
             // Spawn new process for each serializer to measure each serializer overhead in isolation
             var startArgs = new ProcessStartInfo(Assembly.GetEntryAssembly().Location.Replace(".dll", ".exe"), String.Join(" ", Environment.GetCommandLineArgs().Skip(1)) + $" -serializer #{GetSimpleTypeName(serializer.GetType())}")
             {
                 UseShellExecute        = false,
                 RedirectStandardOutput = true,
             };
             Process proc = Process.Start(startArgs);
             // trim newline of newly started process
             string output = proc.StandardOutput.ReadToEnd().Trim(Environment.NewLine.ToCharArray());
             if (i > 0) // trim header since we need it only once
             {
                 output = output.Substring(output.IndexOf('\n') + 1);
             }
             Console.WriteLine(output);
             proc.WaitForExit();
         }
     }
 }
コード例 #2
0
        private void Deserialize()
        {
            var tester = new Test_O_N_Behavior(TestSerializers);

            tester.TestDeserialize(NObjectsToDeSerialize, nRuns: Runs);
        }
コード例 #3
0
        private void Combined()
        {
            var tester = new Test_O_N_Behavior(TestSerializers);

            tester.TestCombined(NObjectsToDeSerialize, nRuns: Runs);
        }
コード例 #4
0
        /// <summary>
        /// Test for each serializer 5 different types the first call effect
        /// </summary>
        private void FirstCall()
        {
            var tester = new Test_O_N_Behavior(StartupSerializersToTest);

            tester.TestSerialize(maxNObjects: 1, nRuns: 1);
        }
コード例 #5
0
        private void Combined()
        {
            var tester = new Test_O_N_Behavior(TestSerializers);

            tester.TestCombined(maxNObjects: MaxObjectCount, nRuns: Runs);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: dbolin/SerializerTests
        /// <summary>
        /// Test for each serializer 5 different types the first call effect
        /// </summary>
        private void FirstCall()
        {
            var tester = new Test_O_N_Behavior(StartupSerializersToTest);

            tester.TestSerialize(new int[] { 1 }, nRuns: 1);
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: aienabled/SerializerTests
        private void Combined()
        {
            var tester = new Test_O_N_Behavior(SerializersToTest);

            tester.TestCombined(nRuns: Runs);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: aienabled/SerializerTests
        private void Serialize()
        {
            var tester = new Test_O_N_Behavior(SerializersToTest);

            tester.TestSerialize(nRuns: Runs);
        }