Exemplo n.º 1
0
        protected TraversalInfo(StateImpl s, StateType st,
            TraversalInfo pred, Via bt)
        {
            stateType = st;
            Via = bt;
            NumProcesses = s.NumProcesses;
            ProcessInfo = s.GetProcessInfo();
            events = s.GetEvents();
            exception = s.Exception;
            IsAcceptingState = s.IsAcceptingState;

            //initialize the plugin information.

            if (pred != null)
            {
                Predecessor = pred;
                CurrentDepth = pred.CurrentDepth + 1;
                zBounds = new ZingerBounds(pred.zBounds.ExecutionCost, pred.zBounds.ChoiceCost);
                zBounds.IncrementDepthCost();

                doDelay = false;
                if (ZingerConfiguration.DoDelayBounding)
                {
                    ZingDBSchedState = s.ZingDBSchedState;
                    ZingDBScheduler = s.ZingDBScheduler;
                }
                else if (ZingerConfiguration.DoPreemptionBounding)
                {
                    preemptionBounding = new ZingPreemptionBounding(ProcessInfo, NumProcesses, Predecessor.preemptionBounding.currentProcess);
                }

                if (ZingerConfiguration.DronacharyaEnabled || ZingerConfiguration.IsPluginEnabled)
                {
                    ZingerPlugin = s.ZingerPlugin;
                    ZingerPluginState = s.ZingerPluginState;
                }
                pred.Successor = this;
                MagicBit = pred.MagicBit;
            }
            else
            {
                zBounds = new ZingerBounds();
                MagicBit = false;
                CurrentDepth = 0;
                if (ZingerConfiguration.DoDelayBounding)
                {
                    ZingDBSchedState = s.ZingDBSchedState.Clone(false);
                    ZingDBScheduler = s.ZingDBScheduler;
                }
                else if (ZingerConfiguration.DoPreemptionBounding)
                {
                    preemptionBounding = new ZingPreemptionBounding(ProcessInfo, NumProcesses, 0);
                }
                if (ZingerConfiguration.DronacharyaEnabled || ZingerConfiguration.IsPluginEnabled)
                {
                    ZingerPlugin = s.ZingerPlugin;
                    ZingerPluginState = s.ZingerPluginState.Clone();
                }
            }
        }
Exemplo n.º 2
0
        public ZingerExternalScheduler()
        {
            var zingerPath = new Uri(
                System.IO.Path.GetDirectoryName(
                    System.Reflection.Assembly.GetExecutingAssembly().CodeBase)
                ).LocalPath;
            var schedDllPath = zingerPath + "\\" + "RunToCompletionDelayingScheduler.dll";

            if (!File.Exists(schedDllPath))
            {
                ZingerUtilities.PrintErrorMessage(String.Format("Scheduler file {0} not found", schedDllPath));
                ZingerConfiguration.DoDelayBounding = false;
                return;
            }

            var schedAssembly = Assembly.LoadFrom(schedDllPath);
            // get class name
            string schedClassName = schedAssembly.GetTypes().Where(t => (t.BaseType.Name == "ZingerDelayingScheduler")).First().FullName;
            var schedStateClassName = schedAssembly.GetTypes().Where(t => (t.BaseType.Name == "ZingerSchedulerState")).First().FullName;
            var schedClassType = schedAssembly.GetType(schedClassName);
            var schedStateClassType = schedAssembly.GetType(schedStateClassName);
            zDelaySched = Activator.CreateInstance(schedClassType) as ZingerDelayingScheduler;
            zSchedState = Activator.CreateInstance(schedStateClassType) as ZingerSchedulerState;
        }