/// <summary> /// Shows a sample loop where an action is executed, and the latency of each execution is recorded. /// </summary> private void RecordMeasurements(IRecorder recorder) { var sut = new SocketTester("google.com"); Action actionToMeasure = sut.CreateAndCloseDatagramSocket; var timer = Stopwatch.StartNew(); do { recorder.Record(actionToMeasure); } while (timer.Elapsed < RunPeriod); Interlocked.Increment(ref _isCompleted); }