Reset() 공개 메소드

public Reset ( ) : void
리턴 void
        private void RunUnary(Channel channel, IInterarrivalTimer timer, BasicProfiler optionalProfiler)
        {
            if (optionalProfiler != null)
            {
                Profilers.SetForCurrentThread(optionalProfiler);
            }

            bool profilerReset = false;

            var client = new BenchmarkService.BenchmarkServiceClient(channel);
            var request = CreateSimpleRequest();
            var stopwatch = new Stopwatch();

            while (!stoppedCts.Token.IsCancellationRequested)
            {
                // after the first stats reset, also reset the profiler.
                if (optionalProfiler != null && !profilerReset && statsResetCount.Count > 0)
                {
                    optionalProfiler.Reset();
                    profilerReset = true;
                }

                stopwatch.Restart();
                client.UnaryCall(request);
                stopwatch.Stop();

                // spec requires data point in nanoseconds.
                histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos);

                timer.WaitForNext();
            }
        }
        public void UnaryCallPerformance()
        {
            var profiler = new BasicProfiler();
            Profilers.SetForCurrentThread(profiler);

            helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
            {
                return request;
            });

            var callDetails = helper.CreateUnaryCall();
            for(int i = 0; i < 3000; i++)
            {
                Calls.BlockingUnaryCall(callDetails, "ABC");
            }

            profiler.Reset();

            for(int i = 0; i < 3000; i++)
            {
                Calls.BlockingUnaryCall(callDetails, "ABC");
            }
            profiler.Dump("latency_trace_csharp.txt");
        }