Exemple #1
0
        public void TakeTime(int numberOfMessages, int numberOfSamples, PipelineInvokerMode pipelineInvokerMode)
        {
            Console.WriteLine($"Running {numberOfSamples} samples with {numberOfMessages} msgs and mode {pipelineInvokerMode}");

            var profilerStats = new PipelineStepProfilerStats();

            var results = Enumerable.Range(1, numberOfSamples)
                          .Select(i =>
            {
                Console.Write($"Performing sample {i}: ");
                var result = RunTest(numberOfMessages, profilerStats, pipelineInvokerMode);
                Console.WriteLine($"{result.TotalSeconds:0.#####}");
                return(result);
            })
                          .Select(t => t.TotalSeconds)
                          .ToList();

            Console.WriteLine($@"{numberOfSamples} runs
Avg s: {results.Average():0.00###}
Avg msg/s: {numberOfMessages / results.Average():0}

Med s: {results.Median():0.00###}
Med msg/s: {numberOfMessages / results.Median():0}

Pipeline invoker: {pipelineInvokerMode}

Stats:
{string.Join(Environment.NewLine, profilerStats.GetAndResetStats().Select(s => $"    {s}"))}");
        }
        public void TakeTime(int numberOfMessages, int numberOfSamples)
        {
            var profilerStats = new PipelineStepProfilerStats();

            var results = Enumerable.Range(1, numberOfSamples)
                          .Select(i =>
            {
                Console.Write($"Performing sample {i}: ");
                var result = RunTest(numberOfMessages, profilerStats);
                Console.WriteLine($"{result.TotalSeconds:0.#####}");
                return(result);
            })
                          .Select(t => t.TotalSeconds)
                          .ToList();

            Console.WriteLine($@"{numberOfSamples} runs
Avg s: {results.Average():0.00###}
Avg msg/s: {numberOfMessages * numberOfSamples / results.Sum():0}

Stats:
{string.Join(Environment.NewLine, profilerStats.GetAndResetStats().Select(s => $"    {s}"))}");
        }