Ejemplo n.º 1
0
        private void ConsumeMsg()
        {
            Consumer consumer = new Consumer();
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            double startThread = stopwatch.Elapsed.TotalMilliseconds;

            string msgKey = "";
            while (NextCounter()<numberOfIteration)
            {
                double start = stopwatch.Elapsed.TotalMilliseconds;
                consumer.Consume(msgContainer, msgKey);
                double end = stopwatch.Elapsed.TotalMilliseconds;

                Console.WriteLine("ConsumeMsg:" + (end - start));
            }
            Console.WriteLine("ConsumeMsg Thread....Elapsed:" + (stopwatch.Elapsed.TotalMilliseconds-startThread));
        }
Ejemplo n.º 2
0
        private void ConsumeMsg(int threadNumber)
        {
            Consumer consumer = new Consumer();
            Stopwatch stopwatch = new Stopwatch();

            barrier.SignalAndWait();

            stopwatch.Start();
            double startThread = stopwatch.Elapsed.TotalMilliseconds;

            while (NextCounter()<numberOfIteration)
            {
                double start = stopwatch.Elapsed.TotalMilliseconds;
                consumer.Consume();
                double end = stopwatch.Elapsed.TotalMilliseconds;

                Console.WriteLine("ConsumeMsg;" + threadNumber + ";" + (end - start));
            }
            Console.WriteLine("ConsumeMsg Thread....Elapsed:" + (stopwatch.Elapsed.TotalMilliseconds-startThread));
        }
Ejemplo n.º 3
0
        private void ConsumeMsg(Object threadContext)
        {
            LPThreadContext lpThreadContext = (LPThreadContext)threadContext;
            int threadIndex = lpThreadContext.ThreadIndex;
            Consumer consumer = new Consumer();
            Stopwatch stopwatch = new Stopwatch();

            barrier.SignalAndWait();

            stopwatch.Start();
            double startThread = stopwatch.Elapsed.TotalMilliseconds;

            while (NextCounter()<numberOfIteration)
            {
                double start = stopwatch.Elapsed.TotalMilliseconds;
                consumer.Consume();
                double end = stopwatch.Elapsed.TotalMilliseconds;

                Console.WriteLine("ConsumeMsg;" + threadIndex + ";" + (end - start));
            }
            Console.WriteLine("ConsumeMsg Thread....Elapsed:" + (stopwatch.Elapsed.TotalMilliseconds-startThread));
            lpThreadContext.ResetEvent.Set();
        }