Beispiel #1
0
        private static void ExecuteScheduler(string title, IScheduler sch, bool breakOut, Query[] qs)
        {
            int q;
            bool complete = false;

            AdminForm frmAdmin = new AdminForm();

            IResults[] res = sch.Init(breakOut, qs);
            ResultsHandler[] rh = new ResultsHandler[res.Length];
            for (q = 0; q < res.Length; q++)
                rh[q] = new ResultsHandler(string.Format("{0}{1}", title, q), res[q]);
            sch.Execute();
            //frmAdmin.Scheduler = sch;
            //frmAdmin.Show();

            while (!complete && !frmAdmin.ShutdownServer)
            {
                //frmAdmin.UpdateStats();
                Thread.Sleep(10000);
                complete = true;
                for (int i = 0; i < rh.Length && complete; i++)
                    complete &= rh[i].EOF;
                //Log.WriteMessage(DataItemPool.ToString(), Log.eMessageType.Debug);
            }

            double totalSec = 0;
            for (int i = 0; i < rh.Length; i++)
            {
                Log.WriteMessage(string.Format("{0} Total Rows: {1}, Time: {2}", rh[i].Name, rh[i].DataCount, rh[i].CompletionTime), Log.eMessageType.Debug);
                totalSec += (((double)rh[i].CompletionTime.Minutes) * 60) +
                    ((double)rh[i].CompletionTime.Seconds) +
                    (((double)rh[i].CompletionTime.Milliseconds) / 1000.0);
            }

            Log.WriteMessage(string.Format("Average Time: {0}", totalSec / rh.Length), Log.eMessageType.Debug);
        }