Exemplo n.º 1
0
        // ***
        private static void AggregateFromMultipleSources()
        {
            IEnumerable <ReplayResult <object> > pc1    = JsonStreamAggregator.Load <object>("masterdata.json");
            IEnumerable <ReplayResult <object> > pc2    = JsonStreamAggregator.Load <object>("masterdata.json");
            IEnumerable <ReplayResult <object> > merged = pc1.Concat(pc2);

            HistogramAggregator aggregator = new HistogramAggregator()
                                             .Add(new CountMetric())
                                             .Add(new TransactionsPerSecMetric());

            StreamAggregator.Replay(merged);

            Console.WriteLine("## Merged demo ##");
            Console.WriteLine(JsonConvert.SerializeObject(aggregator.BuildResultsObjects(), Formatting.Indented));
            Console.ReadKey();
        }
        public static void Run()
        {
            IEnumerable <IResult> rawResults       = null;
            StreamAggregator      streamAggregator = new StreamAggregator(results => rawResults = results);

            HistogramAggregator aggregator = CreateAggregator();

            HistogramAggregator aggregagorOriginal = CreateAggregator();

            StrategyBuilder strategy = new StrategyBuilder()
                                       .SetScenario <BlankScenario>()
                                       .SetThreading(new FixedThreadCount(3))
                                       .SetLimit(new TimeLimit(TimeSpan.FromSeconds(5)))
                                       .SetAggregator(streamAggregator, aggregagorOriginal);

            strategy.Build().Run();

            StreamAggregator.Replay(rawResults, aggregator);

            Console.WriteLine(@"-------- FROM LIVE AGGREGATION --------");
            Console.WriteLine(JsonConvert.SerializeObject(aggregagorOriginal.BuildResultsObjects(), Formatting.Indented));
            Console.WriteLine(@"-------- FROM STREAM --------");
            Console.WriteLine(JsonConvert.SerializeObject(aggregator.BuildResultsObjects(), Formatting.Indented));
        }
Exemplo n.º 3
0
 public static void Replay(this IEnumerable<IResult> results, params IAggregator[] agregators)
 {
     StreamAggregator.Replay(results, agregators);
 }
Exemplo n.º 4
0
        public static void Replay <TUserData>(string jsonResultsFile, params IAggregator[] targetAggregators)
        {
            IEnumerable <IResult> resultsStream = Load <TUserData>(jsonResultsFile);

            StreamAggregator.Replay(resultsStream, targetAggregators);
        }