예제 #1
0
        static void Main(string[] args)
        {
            //FixedTimeBenchmark.Run<CounterMetric>(m => m.Increment());
            //FixedTimeBenchmark.Run<MeterMetric>(m => m.Mark());
            //FixedTimeBenchmark.Run<HistogramMetric>(m => m.Update(1));
            FixedTimeBenchmark.Run <TimerMetric>(m => { using (m.NewContext()) { } }, maxThreads: 32, seconds: 5);

            //FixedIterationsBenchmark.Run<TimerMetric>(m => { using (m.NewContext()) { } }, 1000 * 1000);
        }
예제 #2
0
        public static void Run <T>(Func <T> create, Action <T> action, int maxThreads = 16, int seconds = 5, int decrement = 1)
        {
            T instance = create();

            for (int i = maxThreads; i > 0; i -= decrement)
            {
                var result = FixedTimeBenchmark.MeasureCallsPerSecond(() => action(instance), i, TimeSpan.FromSeconds(seconds));
                Console.WriteLine("{0}\t{1}\t{2,10:N0}", typeof(T).Name, i, result);
            }
        }
예제 #3
0
        public static void Run <T>(Action <T> action, int maxThreads = 16, int seconds = 2)
            where T : new()
        {
            T instance = new T();

            for (int i = maxThreads; i > 0; i--)
            {
                var result = FixedTimeBenchmark.MeasureCallsPerSecond(() => action(instance), i, TimeSpan.FromSeconds(seconds));
                Console.WriteLine("{0}\t{1}\t{2,10:N0}", typeof(T).Name, i, result);
            }
        }
예제 #4
0
        static void Main(string[] args)
        {
            //FixedTimeBenchmark.Run<CounterMetric>(m => m.Increment());
            //FixedTimeBenchmark.Run<MeterMetric>(m => m.Mark());
            //FixedTimeBenchmark.Run<HistogramMetric>(m => m.Update(1));

            FixedTimeBenchmark.Run(() => EWMA.OneMinuteEWMA(), m => m.Update(1), maxThreads: 32, seconds: 5, decrement: 4);

            //FixedTimeBenchmark.Run(() => new TimerMetric(new SlidingWindowReservoir()), m => { using (m.NewContext()) { } }, maxThreads: 32, seconds: 5, decrement: 4);

            //FixedTimeBenchmark.Run(() => new ExponentiallyDecayingReservoir(), r => r.Update(100), maxThreads: 32, seconds: 5, decrement: 4);
            //FixedTimeBenchmark.Run(() => new UniformReservoir(), r => r.Update(100), maxThreads: 32, seconds: 5, decrement: 4);

            //FixedIterationsBenchmark.Run<TimerMetric>(m => { using (m.NewContext()) { } }, 1000 * 1000);
        }
예제 #5
0
 public static void Run <T>(Func <T> create, Action <T> action)
 {
     FixedTimeBenchmark.Run(create, action, targetOptions.MaxThreads, targetOptions.Seconds, targetOptions.Decrement);
 }