예제 #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 Combined()
        {
            var tester = new Test_O_N_Behavior(TestSerializers);

            tester.TestCombined(NObjectsToDeSerialize, nRuns: Runs);
        }
예제 #3
0
        private void Deserialize()
        {
            var tester = new Test_O_N_Behavior(TestSerializers);

            tester.TestDeserialize(NObjectsToDeSerialize, nRuns: Runs);
        }