void Test(NetTest <T> test, T[] msgs, int loops) { test.Prepare(msgs.Length); Console.Write("{0,-13} | {1,-21} | ", test.Specimen.Name, "NetTest"); Console.Out.Flush(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); var c0 = GC.CollectionCount(0); var c1 = GC.CollectionCount(1); var c2 = GC.CollectionCount(2); var sw = Stopwatch.StartNew(); var received = test.Test(msgs, loops, m_direct); sw.Stop(); c0 = GC.CollectionCount(0) - c0; c1 = GC.CollectionCount(1) - c1; c2 = GC.CollectionCount(2) - c2; Console.WriteLine("{0,10} | {1,4} {2,3} {3,3} | {4,10} |", sw.ElapsedMilliseconds, c0, c1, c2, ""); if (Program.EnableResultCheck) { CompareMessages(msgs, received); } }
public void Run(ISerializerSpecimen specimen) { var arr = m_messages.Take(m_numMessages > 10 ? 10 : 1).ToArray(); specimen.Warmup(arr); using (var test = new MemStreamTest <T>(specimen)) Test(test, m_messages, m_loops); using (var test = new NetTest <T>(specimen)) Test(test, m_messages, m_loops); }