Exemplo n.º 1
0
 private static void SpeedCounter2()
 {
     SetupCategory();
     CountersContainer container = new CountersContainer()
                                   {
                                       BytesPerSecCounter = SetupBytesCounter(),
                                       ItemsPerSecCounter = SetupItemsCounter()
                                   };
     new Thread(DoProcessing).Start(container);
     new Thread(DoProcessing).Start(container);
     new Thread(DoProcessing).Start(container);
     new Thread(DoProcessing).Start(container);
     DoProcessing(container);
 }
Exemplo n.º 2
0
        private static void DoProcessing(object arg)
        {
            CountersContainer ctr = arg as CountersContainer;
            Random            r   = new Random(DateTime.Now.Millisecond);

            ctr.ItemsPerSecCounter.NextSample();
            ctr.BytesPerSecCounter.NextSample();
            while (true)
            {
                Thread.Sleep(r.Next(20, 300));
                int messageSize = r.Next(512, 1024 * 500);
                ctr.ItemsPerSecCounter.Increment();
                ctr.BytesPerSecCounter.IncrementBy(messageSize);
            }
        }
Exemplo n.º 3
0
        private static void SpeedCounter2()
        {
            SetupCategory();
            CountersContainer container = new CountersContainer()
            {
                BytesPerSecCounter = SetupBytesCounter(),
                ItemsPerSecCounter = SetupItemsCounter()
            };

            new Thread(DoProcessing).Start(container);
            new Thread(DoProcessing).Start(container);
            new Thread(DoProcessing).Start(container);
            new Thread(DoProcessing).Start(container);
            DoProcessing(container);
        }