示例#1
0
 public Controller(string id, InitialStatus initialSSDStatus, uint percentageOfValidPages, uint validPagesStdDev, FCCBase fcc, int seed)
     : base(id)
 {
     InitialSSDStatus = initialSSDStatus;
     this.initialPercentageOfValidPages        = percentageOfValidPages;
     this.initialPercentagesOfValidPagesStdDev = validPagesStdDev;
     FCC = fcc;
     pageStatusRandomGenerator = new RandomGenerator(seed);
 }
示例#2
0
    public PlayerSettingData(InitialStatus initialStatus)
    {
        //前方向の速度
        velocityZ = initialStatus.velocityZ;
        //横方向の速度
        velocityX = initialStatus.velocityX;
        //上方向の速度
        velocityY = initialStatus.velocityY;
        //横方向の移動量
        setpositionX = initialStatus.setpositionX;
        //左右の移動できる範囲
        movableRange = initialStatus.movableRange;
        //横方向の現在位置
        nowpositionX   = initialStatus.nowpositionX;
        inputVelocityX = initialStatus.inputVelocityX;
        //横移動許可
        movableX = initialStatus.movableX;
        //スライディングのパラメータ
        slidespan  = initialStatus.slidespan;
        slidedelta = initialStatus.slidedelta;
        //攻撃のパラメータ
        //isAttack = initialStatus.isAttack;
        atkspan  = initialStatus.atkspan;
        atkdelta = initialStatus.atkdelta;

        //動きを減速させる係数
        coefficient = initialStatus.coefficient;

        //プレイヤーのHP
        PlayerHP  = initialStatus.HP;
        PlayerAtk = initialStatus.Atk;
        PlayerSpd = initialStatus.Spd;

        InvincibleTime = initialStatus.InvincibleTime;

        AfterDamageTime     = 0;
        SkillTime           = 0;
        SkillActivationTime = 0;
        SkillWaitTime       = 0;
        SkillRecoveryTime   = 0;

        isSliding         = false;
        isGround          = false;
        isDamage          = false;
        isEnableSkill     = true;
        isSkillActivation = false;
        isRocket          = false;
        isSlow            = false;

        isDeath = false;
    }
示例#3
0
        public JsonResult Setup(Juschubut.PdfSign.Common.SignSetup setup)
        {
            string signID = Guid.NewGuid().ToString();

            Juschubut.Logger.Log.Info(string.Format("Setup {0}", signID));

            InitialStatus status = new InitialStatus
            {
                SignID = signID,
                Fecha  = DateTime.Now,
                Codigo = PdfSign.Common.StatusCode.Iniciado
            };

            Sign sign = new Sign
            {
                SignID = signID,
                Status = new List <Status>(new Status[] { status })
            };

            if (setup != null)
            {
                sign.Setup = setup;
            }

            if (sign.Setup == null)
            {
                sign.Setup = new PdfSign.Common.SignSetup();
            }

            if (sign.Setup.Archivos == null || sign.Setup.Archivos.Count == 0)
            {
                setup.Archivos.Add(sign.CrearArchivoDefault());
            }

            for (int i = 0; i < sign.Setup.Archivos.Count; i++)
            {
                sign.Setup.Archivos[i].ID = i + 1;
            }

            Repository.Set(sign);

            Juschubut.Logger.Log.Debug("Setup Result");
            Juschubut.Logger.Log.Debug(Newtonsoft.Json.JsonConvert.SerializeObject(sign));

            return(Status(sign));
        }
        public Controller BuildControllerBus(
            string id,
            uint rowCount,
            uint chipNoPerRow,
            uint channelWidth,
            ulong readTransferCycleTime,
            ulong writeTransferCycleTime,
            ulong readCommandAddressCycleCount,
            ulong writeCommandAddressCycleCount,
            ulong eraseCommandAddressCycleCount,
            ulong dummyBusyTime,
            ulong readDataOutputReadyTime,
            ulong ALEtoDataStartTransitionTime,
            ulong WEtoRBTransitionTime,
            ulong suspendProgramTime,
            ulong suspendEraseTime,
            ulong readLatency,  /*page read delay in nano-seconds*/
            ulong writeLatency, /*page write delay in nano-seconds*/
            ulong eraseLatency, /*block erase delay in nano-seconds*/
            uint dieNoPerChip,
            uint planeNoPerDie,
            uint blockNoPerPlane,
            uint pageNoPerBlock,
            uint pageCapacity,
            uint blockEraseLimit,
            uint hostBufferSize,
            GarbageCollector.GCPolicyType GCType,
            uint RGAConstant,
            uint WGreedyWindowSize,
            bool dynamicWearLevelingEnabled,
            HostInterface.HostInterfaceType hostInterfaceType,
            InitialStatus initialStatus,
            uint percentageOfValidPages,
            uint validPagesStdDev,
            double overprovisionRatio,
            bool dataCachingEnabled,
            uint dataCacheCapacity,
            bool dftlEnabled,
            uint dftlCapacity,
            IOSchedulingPolicy ioSchedulingPolicy,
            uint windowSize,
            PlaneAllocationSchemeType planeAllocationScheme,
            BlockAllocationSchemeType blockAllocationScheme,
            bool twainBlockManagementEnabled,
            bool copyBackEnabled,
            bool copyBackOddEvenPageConstraint,
            bool multiplaneCMDEnabled,
            bool iBAConstraintForMultiplane,
            bool interleavedCMDEnabled,
            uint readToWritePrioritizationFactor,
            uint writeToErasePrioritizationFactor,
            WorkloadParameterSet[] Workloads,
            bool LoggingEnabled,
            MultistageSchedulingParameters copParameters,
            string RTLogFilePath,//path of response time log file: Used to record each response time of each request
            FlashChip[][] flashChips,
            int seed
            )
        {
            Controller ctrl = new Controller(id, initialStatus, percentageOfValidPages, validPagesStdDev, null, ++seed);

            GarbageCollector gc = new GarbageCollector(id + ".GC", GCType, RGAConstant, WGreedyWindowSize, overprovisionRatio,
                                                       rowCount * chipNoPerRow, pageNoPerBlock * blockNoPerPlane, blockNoPerPlane, pageNoPerBlock,
                                                       dynamicWearLevelingEnabled, copyBackEnabled, copyBackOddEvenPageConstraint, multiplaneCMDEnabled,
                                                       interleavedCMDEnabled, LoggingEnabled,
                                                       twainBlockManagementEnabled, RTLogFilePath, ++seed);
            int numberOfInputStreams = Workloads.Length;

            AddressMappingDomain[] addressMappingDomains = new AddressMappingDomain[numberOfInputStreams];
            for (int i = 0; i < Workloads.Length; i++)
            {
                string[] channelIDs = Workloads[i].ChannelIDs.Split(Separator);
                uint[]   channels   = new uint[channelIDs.Length];
                for (int j = 0; j < channels.Length; j++)
                {
                    channels[j] = uint.Parse(channelIDs[j]);
                }
                Array.Sort(channels);
                if (channels[channels.Length - 1] >= rowCount)
                {
                    throw new Exception("Bad channel number specified for workload No " + i + "!");
                }

                string[] chiplIDs = Workloads[i].ChipIDs.Split(Separator);
                uint[]   chips    = new uint[chiplIDs.Length];
                for (int j = 0; j < chips.Length; j++)
                {
                    chips[j] = uint.Parse(chiplIDs[j]);
                }
                Array.Sort(chips);
                if (chips[chips.Length - 1] >= chipNoPerRow)
                {
                    throw new Exception("Bad chip number specified for workload No  " + i + "!");
                }

                string[] dieIDs = Workloads[i].DieIDs.Split(Separator);
                uint[]   dies   = new uint[dieIDs.Length];
                for (int j = 0; j < dies.Length; j++)
                {
                    dies[j] = uint.Parse(dieIDs[j]);
                }
                Array.Sort(dies);
                if (dies[dies.Length - 1] >= dieNoPerChip)
                {
                    throw new Exception("Bad die number specified for workload No " + i + "!");
                }

                string[] planesIDs = Workloads[i].PlaneIDs.Split(Separator);
                uint[]   planes    = new uint[planesIDs.Length];
                for (int j = 0; j < planes.Length; j++)
                {
                    planes[j] = uint.Parse(planesIDs[j]);
                }
                Array.Sort(planes);
                if (planes[planes.Length - 1] >= planeNoPerDie)
                {
                    throw new Exception("Bad die number specified for stream No " + i + "!");
                }

                addressMappingDomains[i] = new AddressMappingDomain(planeAllocationScheme, blockAllocationScheme, channels, chips, dies, planes,
                                                                    blockNoPerPlane, pageNoPerBlock, pageCapacity / FTL.SubPageCapacity, overprovisionRatio, dftlEnabled, dftlCapacity);
            }

            FTL ftl = new FTL(id + ".FTL",
                              planeAllocationScheme, blockAllocationScheme, ioSchedulingPolicy, false, multiplaneCMDEnabled,
                              iBAConstraintForMultiplane, interleavedCMDEnabled, null, GCType,
                              gc, addressMappingDomains, flashChips, rowCount,
                              chipNoPerRow, dieNoPerChip, planeNoPerDie, blockNoPerPlane, pageNoPerBlock,
                              pageCapacity, blockEraseLimit, overprovisionRatio,
                              readLatency, writeLatency, eraseLatency, seed++);

            ctrl.AddXObject(ftl);
            ftl.Controller = ctrl;
            gc.FTL         = ftl;
            ctrl.FTL       = ftl;

            DRAMDataCache dram = new DRAMDataCache(ftl, dataCacheCapacity);

            ftl.DRAM  = dram;
            ctrl.DRAM = dram;

            HostInterface        HI            = null;
            NVMeIODispatcherBase nvmeIOHandler = null;
            IOSchedulerBase      ioScheduler   = null;

            switch (hostInterfaceType)
            {
            case HostInterface.HostInterfaceType.SATATraceBased:
                HI = new HostInterface(id + ".HostInterface", hostBufferSize, ftl, ctrl,
                                       NotListedMessageGenerationParameterSet.Mode, (Workloads[0] as TraceBasedParameterSet).FilePath, (Workloads[0] as TraceBasedParameterSet).PercentageToBeSimulated,
                                       LoggingEnabled, RTLogFilePath,
                                       (Workloads[0] as TraceBasedParameterSet).ReplayCount, NotListedMessageGenerationParameterSet.FoldAddress, NotListedMessageGenerationParameterSet.IgnoreUnallocatedReads);

                ioScheduler = new IOSchedulerSprinkler(id + ".IOScheduler", ftl, readToWritePrioritizationFactor, suspendProgramTime, suspendEraseTime, readTransferCycleTime, writeTransferCycleTime);
                break;

            case HostInterface.HostInterfaceType.NVMe:
            {
                InputStreamBase[] inputStreams = new InputStreamBase[numberOfInputStreams];
                for (int i = 0; i < numberOfInputStreams; i++)
                {
                    WorkloadParameterSet streamParameter = Workloads[i];
                    if (streamParameter is TraceBasedParameterSet)
                    {
                        int fileNameStartIndex = 0;
                        if ((streamParameter as TraceBasedParameterSet).FilePath.IndexOf("/") >= 0)
                        {
                            fileNameStartIndex = (streamParameter as TraceBasedParameterSet).FilePath.LastIndexOf("/");
                        }
                        else
                        if ((streamParameter as TraceBasedParameterSet).FilePath.IndexOf("\\") >= 0)
                        {
                            fileNameStartIndex = (streamParameter as TraceBasedParameterSet).FilePath.LastIndexOf("\\");
                        }
                        inputStreams[i] = new InputStreamTraceBased((streamParameter as TraceBasedParameterSet).FilePath.Remove(0, fileNameStartIndex),
                                                                    (streamParameter as TraceBasedParameterSet).FilePath, (streamParameter as TraceBasedParameterSet).PriorityClass,
                                                                    (streamParameter as TraceBasedParameterSet).PercentageToBeSimulated,
                                                                    (streamParameter as TraceBasedParameterSet).ReplayCount, 10000, addressMappingDomains[i], ++seed);
                    }
                    else
                    {
                        inputStreams[i] = new InputStreamSynthetic("SynthFlow" + i,
                                                                   (streamParameter as SyntheticParameterSet).PriorityClass,
                                                                   addressMappingDomains[i],
                                                                   (streamParameter as SyntheticParameterSet).TotalNumberOfRequests,
                                                                   (streamParameter as SyntheticParameterSet).AverageRequestInterArrivalTime,
                                                                   (streamParameter as SyntheticParameterSet).ReadRatio,
                                                                   (streamParameter as SyntheticParameterSet).AddressDistType,
                                                                   (streamParameter as SyntheticParameterSet).AddressDistParam1,
                                                                   (streamParameter as SyntheticParameterSet).AddressDistParam2,
                                                                   (streamParameter as SyntheticParameterSet).reqSizeDistType,
                                                                   (streamParameter as SyntheticParameterSet).reqSizeDistParam1,
                                                                   (streamParameter as SyntheticParameterSet).reqSizeDistParam2, ++seed);
                    }
                }

                HI = new HostInterfaceNVMe(id + ".HostInterface", ftl, ctrl, numberOfInputStreams, inputStreams, LoggingEnabled, RTLogFilePath);

                switch (ioSchedulingPolicy)
                {
                case IOSchedulingPolicy.Sprinkler:
                    nvmeIOHandler = new NVMeIODispatcherSimple(id + ".HILogic", ftl, HI, (uint)numberOfInputStreams, windowSize);
                    ioScheduler   = new IOSchedulerSprinkler(id + ".IOScheduler", ftl, readToWritePrioritizationFactor, suspendProgramTime, suspendEraseTime, readTransferCycleTime, writeTransferCycleTime);
                    break;

                case IOSchedulingPolicy.MultiStageAllFair:
                case IOSchedulingPolicy.MultiStageSoftQoS:
                case IOSchedulingPolicy.MultiStageMultiplePriorities:
                    nvmeIOHandler = new NVMeIODispatcherRPB(id + ".HILogic", ftl, HI, 1024, inputStreams, rowCount, copParameters.HistoryUpdateInterval);
                    ioScheduler   = new IOSchedulerRPB(id + ".IOScheduler", ftl, ioSchedulingPolicy, nvmeIOHandler as NVMeIODispatcherRPB, copParameters.BatchSize, numberOfInputStreams,
                                                       readToWritePrioritizationFactor, writeToErasePrioritizationFactor, copParameters.RateControllerEnabled, copParameters.PriorityControllerEnabled, copParameters.ReadWriteBalancerEnabled,
                                                       suspendProgramTime, suspendEraseTime, readTransferCycleTime, writeTransferCycleTime);
                    break;
                }
            }
            break;

            case HostInterface.HostInterfaceType.SATASynthetic:
            /*HI = new HostInterfaceSynthetic(id + ".HostInterface", hostBufferSize, ftl, ctrl, NotListedMessageGenerationParameterSet.Mode,
             *  workloadProperties.SyntheticGenerationProperties[0].TotalNumberOfRequests, workloadProperties.SyntheticGenerationProperties[0].AverageRequestInterArrivalTime,
             *  workloadProperties.SyntheticGenerationProperties[0].ReadPercentage,
             *  workloadProperties.SyntheticGenerationProperties[0].AddressDistType,
             *  workloadProperties.SyntheticGenerationProperties[0].AddressDistParam1, workloadProperties.SyntheticGenerationProperties[0].AddressDistParam2,
             *  workloadProperties.SyntheticGenerationProperties[0].reqSizeDistType,
             *  workloadProperties.SyntheticGenerationProperties[0].reqSizeDistParam1, workloadProperties.SyntheticGenerationProperties[0].reqsizeDistParam2,
             ++seed, workloadProperties.LoggingEnabled, RTLogFilePath);
             * break;*/
            default:
                throw new Exception("Unknown HostInterface type!");
            }
            ftl.HostInterface  = HI;
            ftl.IOScheduler    = ioScheduler;
            ctrl.HostInterface = HI;
            ctrl.AddXObject(HI);
            ctrl.AddXObject(nvmeIOHandler);
            //readDataOutputReadyTime += readTransferCycleTime;
            FCCBase fcc = null;

            switch (ioSchedulingPolicy)
            {
            case IOSchedulingPolicy.Sprinkler:
                fcc = new FCCMultiChannelBusSimple(id + ".FCC", readTransferCycleTime, writeTransferCycleTime, readCommandAddressCycleCount,
                                                   writeCommandAddressCycleCount, eraseCommandAddressCycleCount, dummyBusyTime, readDataOutputReadyTime, ALEtoDataStartTransitionTime,
                                                   WEtoRBTransitionTime, readLatency, writeLatency, eraseLatency, pageCapacity,
                                                   channelWidth / FTL.ByteSize, ftl, flashChips, ftl.ChannelInfos as BusChannelSprinkler[], HI);
                break;

            case IOSchedulingPolicy.MultiStageAllFair:
            case IOSchedulingPolicy.MultiStageSoftQoS:
            case IOSchedulingPolicy.MultiStageMultiplePriorities:
                fcc = new FCCMultiChannelBusRPB(id + ".FCC", readTransferCycleTime, writeTransferCycleTime, readCommandAddressCycleCount,
                                                writeCommandAddressCycleCount, eraseCommandAddressCycleCount, dummyBusyTime, readDataOutputReadyTime, ALEtoDataStartTransitionTime,
                                                WEtoRBTransitionTime, readLatency, writeLatency, eraseLatency, suspendProgramTime, suspendEraseTime, copParameters.HistoryUpdateInterval, pageCapacity,
                                                channelWidth / FTL.ByteSize, ftl, flashChips, ftl.ChannelInfos as BusChannelRPB[], HI);
                break;

            default:
                throw new Exception("Unhandled scheduling type!");
            }
            ftl.FCC  = fcc;
            ctrl.FCC = fcc;

            return(ctrl);
        }