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); }
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); } }
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); }