예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OperationScheduler"/> class.
        /// </summary>
        private OperationScheduler(SchedulingPolicy policy, IRandomValueGenerator valueGenerator, Configuration configuration)
        {
            this.Configuration    = configuration;
            this.SchedulingPolicy = policy;
            this.ValueGenerator   = valueGenerator;

            if (!configuration.UserExplicitlySetLivenessTemperatureThreshold &&
                configuration.MaxFairSchedulingSteps > 0)
            {
                configuration.LivenessTemperatureThreshold = configuration.MaxFairSchedulingSteps / 2;
            }

            if (this.SchedulingPolicy is SchedulingPolicy.Systematic)
            {
                this.Strategy = SystematicStrategy.Create(configuration, this.ValueGenerator);
                if (this.Strategy is ReplayStrategy replayStrategy)
                {
                    this.ReplayStrategy      = replayStrategy;
                    this.IsReplayingSchedule = true;
                }

                // Wrap the strategy inside a liveness checking strategy.
                if (this.Configuration.IsLivenessCheckingEnabled)
                {
                    this.Strategy = new TemperatureCheckingStrategy(this.Configuration, this.Strategy as SystematicStrategy);
                }
            }
            else if (this.SchedulingPolicy is SchedulingPolicy.Fuzzing)
            {
                this.Strategy = FuzzingStrategy.Create(configuration, this.ValueGenerator);
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OperationScheduler"/> class.
        /// </summary>
        private OperationScheduler(Configuration configuration, SchedulingPolicy policy, IRandomValueGenerator generator)
        {
            this.Configuration    = configuration;
            this.SchedulingPolicy = policy;
            this.ValueGenerator   = generator;

            this.Reducers = new List <IScheduleReducer>();
            if (configuration.IsSharedStateReductionEnabled)
            {
                this.Reducers.Add(new SharedStateReducer());
            }

            if (!configuration.UserExplicitlySetLivenessTemperatureThreshold &&
                configuration.MaxFairSchedulingSteps > 0)
            {
                configuration.LivenessTemperatureThreshold = configuration.MaxFairSchedulingSteps / 2;
            }

            if (this.SchedulingPolicy is SchedulingPolicy.Interleaving)
            {
                this.Strategy = InterleavingStrategy.Create(configuration, generator);
                if (this.Strategy is ReplayStrategy replayStrategy)
                {
                    this.ReplayStrategy      = replayStrategy;
                    this.IsReplayingSchedule = true;
                }

                // Wrap the strategy inside a liveness checking strategy.
                if (configuration.IsLivenessCheckingEnabled)
                {
                    this.Strategy = new TemperatureCheckingStrategy(configuration, generator,
                                                                    this.Strategy as InterleavingStrategy);
                }
            }
            else if (this.SchedulingPolicy is SchedulingPolicy.Fuzzing)
            {
                this.Strategy = FuzzingStrategy.Create(configuration, generator);
            }
        }
예제 #3
0
 public virtual void TestDRFPolicy()
 {
     TestComputeShares(SchedulingPolicy.GetInstance(typeof(DominantResourceFairnessPolicy
                                                           )));
 }
예제 #4
0
 public virtual void TestFairSharePolicy()
 {
     TestComputeShares(SchedulingPolicy.GetInstance(typeof(FairSharePolicy)));
 }
예제 #5
0
 private void TestComputeShares(SchedulingPolicy policy)
 {
     policy.ComputeShares(schedulables, Resources.None());
 }
예제 #6
0
 /// <summary>
 /// Returns the hashed state of this operation for the specified policy.
 /// </summary>
 internal virtual int GetHashedState(SchedulingPolicy policy) => 0;
예제 #7
0
 /// <summary>
 /// Creates a new instance of the <see cref="OperationScheduler"/> class.
 /// </summary>
 internal static OperationScheduler Setup(SchedulingPolicy policy, IRandomValueGenerator valueGenerator,
                                          Configuration configuration) =>
 new OperationScheduler(policy, valueGenerator, configuration);
예제 #8
0
 /// <inheritdoc/>
 internal override int GetHashedState(SchedulingPolicy policy) => this.Actor.GetHashedState(policy);
예제 #9
0
        public void InitEnumsFromStrings()
        {
            if (ADDRESS_MAPPING_SCHEME == "scheme1")
            {
                addressMappingScheme = AddressMappingScheme.Scheme1;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 1");
                    }
                }
            }
            else if (ADDRESS_MAPPING_SCHEME == "scheme2")
            {
                addressMappingScheme = AddressMappingScheme.Scheme2;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 2");
                    }
                }
            }
            else if (ADDRESS_MAPPING_SCHEME == "scheme3")
            {
                addressMappingScheme = AddressMappingScheme.Scheme3;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 3");
                    }
                }
            }
            else if (ADDRESS_MAPPING_SCHEME == "scheme4")
            {
                addressMappingScheme = AddressMappingScheme.Scheme4;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 4");
                    }
                }
            }
            else if (ADDRESS_MAPPING_SCHEME == "scheme5")
            {
                addressMappingScheme = AddressMappingScheme.Scheme5;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 5");
                    }
                }
            }
            else if (ADDRESS_MAPPING_SCHEME == "scheme6")
            {
                addressMappingScheme = AddressMappingScheme.Scheme6;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 6");
                    }
                }
            }
            else if (ADDRESS_MAPPING_SCHEME == "scheme7")
            {
                addressMappingScheme = AddressMappingScheme.Scheme7;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ADDR SCHEME: 7");
                    }
                }
            }
            else
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("WARNING: unknown address mapping scheme '" + ADDRESS_MAPPING_SCHEME + "'; valid values are 'scheme1'...'scheme7'. Defaulting to scheme1");
                }
                addressMappingScheme = AddressMappingScheme.Scheme1;
            }

            if (ROW_BUFFER_POLICY == "open_page")
            {
                rowBufferPolicy = RowBufferPolicy.OpenPage;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ROW BUFFER: open page");
                    }
                }
            }
            else if (ROW_BUFFER_POLICY == "close_page")
            {
                rowBufferPolicy = RowBufferPolicy.ClosePage;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: ROW BUFFER: close page");
                    }
                }
            }
            else
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("WARNING: unknown row buffer policy '" + ROW_BUFFER_POLICY + "'; valid values are 'open_page' or 'close_page', Defaulting to Close Page.");
                }
                rowBufferPolicy = RowBufferPolicy.ClosePage;
            }

            if (QUEUING_STRUCTURE == "per_rank_per_bank")
            {
                queuingStructure = QueuingStructure.PerRankPerBank;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: QUEUING STRUCT: per rank per bank");
                    }
                }
            }
            else if (QUEUING_STRUCTURE == "per_rank")
            {
                queuingStructure = QueuingStructure.PerRank;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: QUEUING STRUCT: per rank");
                    }
                }
            }
            else
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("WARNING: Unknown queueing structure '" + QUEUING_STRUCTURE + "'; valid options are 'per_rank' and 'per_rank_per_bank', defaulting to Per Rank Per Bank");
                }
                queuingStructure = QueuingStructure.PerRankPerBank;
            }

            if (SCHEDULING_POLICY == "rank_then_bank_round_robin")
            {
                schedulingPolicy = SchedulingPolicy.RankThenBankRoundRobin;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: SCHEDULING: Rank Then Bank");
                    }
                }
            }
            else if (SCHEDULING_POLICY == "bank_then_rank_round_robin")
            {
                schedulingPolicy = SchedulingPolicy.BankThenRankRoundRobin;
                if (DEBUG_INI_READER)
                {
                    if (Config.DEBUG_MEMORY)
                    {
                        DEBUG.WriteLine("DEBUG: SCHEDULING: Bank Then Rank");
                    }
                }
            }
            else
            {
                if (Config.DEBUG_MEMORY)
                {
                    DEBUG.WriteLine("WARNING: Unknown scheduling policy '" + SCHEDULING_POLICY + "'; valid options are 'rank_then_bank_round_robin' or 'bank_then_rank_round_robin'; defaulting to Bank Then Rank Round Robin");
                }
                schedulingPolicy = SchedulingPolicy.BankThenRankRoundRobin;
            }
        }
예제 #10
0
 /// <summary>
 /// Creates a new instance of the <see cref="OperationScheduler"/> class.
 /// </summary>
 internal static OperationScheduler Setup(Configuration configuration, SchedulingPolicy policy,
                                          IRandomValueGenerator valueGenerator) =>
 new OperationScheduler(configuration, policy, valueGenerator);