Ejemplo n.º 1
0
        public void Run()
        {
            Console.WriteLine("Running TPCC workload...");
            ForceGC();
            this.startTicks = DateTime.UtcNow;

            Thread[] threads = new Thread[workerCount];
            for (int i = 0; i < this.workerCount; i++)
            {
                threads[i] = new Thread(tpccWorkers[i].Run);
                threads[i].Start();
            }

            WorkerMonitor monitor = new WorkerMonitor(this.tpccWorkers);

            monitor.StartBlocking(100);

            foreach (Thread thread in threads)
            {
                thread.Join();
            }

            this.endTicks = DateTime.UtcNow;
            Console.WriteLine($"Monitor Suggested throughput: {monitor.SuggestThroughput()}");
        }
Ejemplo n.º 2
0
        public SingletonYcsbBenchmark.BenchResult Go()
        {
            Thread[] threads = new Thread[this.workers.Length];
            GC.Collect();
            DateTime startTime = DateTime.UtcNow;

            for (int i = 0; i < this.workers.Length; ++i)
            {
                threads[i] = new Thread(this.workers[i].Run);
                threads[i].Start();
            }

            WorkerMonitor monitor = new WorkerMonitor(this.workers);

            monitor.StartBlocking(100);

            foreach (Thread t in threads)
            {
                t.Join();
            }
            DateTime endTime = DateTime.UtcNow;
            var      result  = YcsbBenchmarkEnv.CombineOutputs(
                this.workers.Select(w => w.output).ToArray(),
                endTime - startTime);

            result.SuggestedThroughput = monitor.SuggestThroughput();
            return(result);
        }
Ejemplo n.º 3
0
        protected override void Run()
        {
            while (true)
            {
                WorkerMonitor.SendReport(this.Thread.Name, WorkerActivityType.WaitingForWork, null);

                TJob job;
                int  result = jobQueue.WaitForJob(TimeSpan.FromSeconds(10), out job);

                if (result == 0)
                {
                    break;
                }
                if (result == WaitHandle.WaitTimeout)
                {
                    continue;
                }

                WorkerMonitor.SendReport(this.Thread.Name, WorkerActivityType.ExecutingWork, null);
                ExecuteJob(job);
            }
        }