static void Main(string[] args) { // This app is meant as a tool for benchmarking performance when developing features. // Run it a few times before starting work on a new feature and then continually as you // make changes to monitor your progress. var sw = Stopwatch.StartNew(); Run(); var warmupRun = sw.Elapsed; Console.WriteLine("Warm up round without RxSpy took {0:N4}", warmupRun.TotalSeconds); sw.Restart(); Run(); var pureRun = sw.Elapsed; Console.WriteLine("Stress test without RxSpy took {0:N4}", pureRun.TotalSeconds); // Launching with the streamwriter will benchmark serialization performance but not // create a huge file on disk. var fakeStream = new StressTestStream(); var eventHandler = new StressTestEventHandler(new RxSpyStreamWriter(fakeStream)); sw.Restart(); using (RxSpySession.Launch(eventHandler)) { Run(); } var spyRun = sw.Elapsed; Log("Stress test run took {0:N4}, captured {1:N0} events, {2:N0} observables", spyRun.TotalSeconds, eventHandler.EventCount, eventHandler.ObservableCount); Log("Produced {0:N0} bytes of event output", fakeStream.Length); Log("RxSpy was {0:N2}x slower", spyRun.TotalSeconds / pureRun.TotalSeconds); if (!Debugger.IsAttached) { Console.ReadLine(); } }
static void Main(string[] args) { // This app is meant as a tool for benchmarking performance when developing features. // Run it a few times before starting work on a new feature and then continually as you // make changes to monitor your progress. var sw = Stopwatch.StartNew(); Run(); var warmupRun = sw.Elapsed; Console.WriteLine("Warm up round without RxSpy took {0:N4}", warmupRun.TotalSeconds); sw.Restart(); Run(); var pureRun = sw.Elapsed; Console.WriteLine("Stress test without RxSpy took {0:N4}", pureRun.TotalSeconds); // Launching with the streamwriter will benchmark serialization performance but not // create a huge file on disk. var fakeStream = new StressTestStream(); var eventHandler = new StressTestEventHandler(new RxSpyStreamWriter(fakeStream)); sw.Restart(); using (RxSpySession.Launch(eventHandler)) { Run(); } var spyRun = sw.Elapsed; Log("Stress test run took {0:N4}, captured {1:N0} events, {2:N0} observables", spyRun.TotalSeconds, eventHandler.EventCount, eventHandler.ObservableCount); Log("Produced {0:N0} bytes of event output", fakeStream.Length); Log("RxSpy was {0:N2}x slower", spyRun.TotalSeconds / pureRun.TotalSeconds); if (!Debugger.IsAttached) Console.ReadLine(); }