コード例 #1
0
        public HostInterfaceSynthetic(
            string id,
            uint NCQSize,
            FTL ftl,
            Controller controller,
            AddressMappingDomain mappingDomain,
            HostInterface.ReqeustGenerationMode mode,
            ulong numberOfRequestsToBeGenerated,
            ulong averageRequestInterArrivalTime,
            uint readPercentage,
            InputStreamSynthetic.DistributionType addressDistributionType,
            double addressDistributionParam1,
            double addressDistributionParam2,
            InputStreamSynthetic.DistributionType requestSizeDistributionType,
            uint requestSizeDistributionParam1B,
            uint requestSizeDistributionParam2B,
            int seed,
            bool RTLoggingEnabled,
            string RTLogFilePath)
            : base(id)
        {
            this.NCQSize    = NCQSize;
            this.FTL        = ftl;
            this.Controller = controller;
            this.Mode       = mode;

            this.numberOfRequestsToBeSeen = numberOfRequestsToBeGenerated;
            this.reqNoUnit = numberOfRequestsToBeGenerated;
            this.averageRequestInterArrivalTime = averageRequestInterArrivalTime;
            this.readRatio = (double)readPercentage / (double)100;

            inputStream = new InputStreamSynthetic("SynthFlow0", StreamPriorityClass.High, mappingDomain, numberOfRequestsToBeGenerated,
                                                   averageRequestInterArrivalTime, readPercentage, addressDistributionType, addressDistributionParam1, addressDistributionParam2,
                                                   requestSizeDistributionType, requestSizeDistributionParam1B, requestSizeDistributionParam2B, seed++);

            this.RTLoggingEnabled = RTLoggingEnabled;
            if (RTLoggingEnabled)
            {
                this.RTLogFilePath = RTLogFilePath;
                this.RTLogFile     = new StreamWriter(RTLogFilePath);
                //this.RTLogFile.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)\tAverageRatePerMillisecond(gc/s)\tAverageRatePerMillisecondThisRound(gc/s)");
                this.RTLogFile.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)\tMultiplaneReadCommandRatio\tInterleavedReadCommandRatio\tMultiplaneWriteCommandRatio\tInterleavedWriteCommandRatio\tAverageRatePerMillisecond(gc/s)\tAverageRatePerMillisecondThisRound(gc/s)\tAverageReadCMDWaitingTime(us)\tAverageProgramCMDWaitingTime(us)");
                this.RTLogFileR = new StreamWriter(RTLogFilePath.Remove(RTLogFilePath.LastIndexOf(".log")) + "-R.log");
                this.RTLogFileR.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)");
                this.RTLogFileW = new StreamWriter(RTLogFilePath.Remove(RTLogFilePath.LastIndexOf(".log")) + "-W.log");
                this.RTLogFileW.WriteLine("Time(us)\tAverageResponseTime(us)\tThisRoundAverageResponseTime(us)");
            }
        }
コード例 #2
0
        public InputStreamTraceBased(string flowName, string traceFilePath, StreamPriorityClass priorityClass, uint percentageToBeSimulated, uint replayCount,
                                     uint totalLinesInLogfile, AddressMappingDomain addressMappingDomain, int seed) : base(flowName, priorityClass, addressMappingDomain)
        {
            _traceFilePath               = traceFilePath;
            _inputFile                   = new StreamReader(_traceFilePath);
            TotalReplayCount             = replayCount;
            randomAddressOffsetGenerator = new RandomGenerator(seed);

            this.percentageToBeSimulated = percentageToBeSimulated;
            if (this.percentageToBeSimulated > 100)
            {
                this.percentageToBeSimulated = 100;
                Console.WriteLine(@"Bad value for percentage of simulation! It is automatically set to 100%");
            }

            #region CalculateReqNo
            //calculate how many requets should be handled during simulation
            StreamReader traceFile2 = new StreamReader(_traceFilePath);
            string[]     currentInputLine;
            while (traceFile2.Peek() >= 0)
            {
                currentInputLine = traceFile2.ReadLine().Split(HostInterface.Separator);
                if (currentInputLine.Length < 5)
                {
                    break;
                }
                totalRequestsInFile++;
                lastRequestArrivalTime = ulong.Parse(currentInputLine[HostInterface.ASCIITraceTimeColumn]);
            }
            SimulationStopTime = lastRequestArrivalTime * replayCount;
            traceFile2.Close();
            #endregion

            NextInputLine = null;
            if (_inputFile.Peek() >= 0)
            {
                NextInputLine = _inputFile.ReadLine().Split(HostInterface.Separator);
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public InputStreamSynthetic(string flowName, StreamPriorityClass priorityClass, AddressMappingDomain addressMappingDomain,
                                    ulong numberOfRequestsToBeGenerated,
                                    ulong averageRequestInterArrivalTime,
                                    double readRatio,
                                    DistributionType addressDistributionType,
                                    double addressDistributionParam1,
                                    double addressDistributionParam2,
                                    DistributionType requestSizeDistributionType,
                                    uint requestSizeDistributionParam1B,
                                    uint requestSizeDistributionParam2B,
                                    int seed)
            : base(flowName, priorityClass, addressMappingDomain)
        {
            NumberOfRequestsToGenerate          = numberOfRequestsToBeGenerated;
            this.averageRequestInterArrivalTime = averageRequestInterArrivalTime;
            this.readRatio     = readRatio;
            SimulationStopTime = averageRequestInterArrivalTime * numberOfRequestsToBeGenerated;

            this.addressDistributionType = addressDistributionType;
            switch (addressDistributionType)
            {
            case DistributionType.Uniform:
                if (addressDistributionParam1 > addressDistributionParam2)
                {
                    Console.WriteLine("Bad parameter specified for address distribution");
                    double temp = addressDistributionParam1;
                    addressDistributionParam1 = addressDistributionParam2;
                    addressDistributionParam2 = temp;
                }

                if (addressDistributionParam1 != 0 && addressDistributionParam1 <= 1)
                {
                    this._addressDistributionParam1 = (ulong)(addressDistributionParam1 * addressMappingDomain.LargestLSN);
                }
                else if (addressDistributionParam1 != 0)
                {
                    addressDistributionParam1 = 0;
                    Console.WriteLine("Bad parameter specified for address distribution");
                }
                if (addressDistributionParam2 != 0 && addressDistributionParam2 <= 1 && addressDistributionParam1 < addressDistributionParam2)
                {
                    this._addressDistributionParam2 = (ulong)(addressDistributionParam2 * addressMappingDomain.LargestLSN);
                }
                else
                {
                    if (addressDistributionParam2 > 1)
                    {
                        Console.WriteLine("Bad parameter specified for address distribution");
                    }
                    this._addressDistributionParam2 = addressMappingDomain.LargestLSN;
                }
                break;

            case DistributionType.Normal:
                if (addressDistributionParam1 > 0 && addressDistributionParam1 < addressMappingDomain.LargestLSN)
                {
                    this._addressDistributionParam1 = ((ulong)addressDistributionParam1 * addressMappingDomain.LargestLSN);
                }
                else
                {
                    this._addressDistributionParam1 = addressMappingDomain.LargestLSN / 2;
                    Console.WriteLine("Bad parameter specified for address distribution");
                }

                this._addressDistributionParam2 = ((ulong)addressDistributionParam2 * addressMappingDomain.LargestLSN);
                break;

            case DistributionType.HotCold:
                if (!(addressDistributionParam1 <= 1.0))
                {
                    addressDistributionParam1 = 0;
                    Console.WriteLine("Bad value for f in Hot/Cold address distribution!\nI set it to zero.");
                }
                if (!(addressDistributionParam2 <= 0.1))
                {
                    addressDistributionParam2 = 0;
                    Console.WriteLine("Bad value for r in Hot/Cold address distribution!\nI set it to zero.");
                }
                hotSpaceRatio   = addressDistributionParam1;
                hotTrafficRate  = addressDistributionParam2;
                hotAddressRange = (ulong)(hotSpaceRatio * addressMappingDomain.LargestLSN);
                RandomGenerator tempRand = new RandomGenerator(++seed);                                                               //Math.Abs(DateTime.Now.Ticks.GetHashCode()));
                this._addressDistributionParam1 = tempRand.UniformULong(0, addressMappingDomain.LargestLSN - (ulong)hotAddressRange); //Used to find the start address of the hot area

                addressGenerationSeed2      = ++seed;
                randomHotColdRatioGenerator = new RandomGenerator(addressGenerationSeed2);
                addressGenerationSeed3      = ++seed;
                randomHotAddressGenerator   = new RandomGenerator(addressGenerationSeed3);
                break;

            case DistributionType.Fixed:
            default:
                throw new Exception("Unhandled address distribution type!");
            }

            this.requestSizeDistributionType     = requestSizeDistributionType;
            _requestSizeDistributionParam1Sector = requestSizeDistributionParam1B;
            _requestSizeDistributionParam2Sector = requestSizeDistributionParam2B;
            if (this.requestSizeDistributionType == DistributionType.Uniform)
            {
                if (requestSizeDistributionParam1B > requestSizeDistributionParam2B)
                {
                    Console.WriteLine("Bad parameter sepcified for request size distribution");
                    uint temp = _requestSizeDistributionParam1Sector;
                    _requestSizeDistributionParam1Sector = _requestSizeDistributionParam2Sector;
                    _requestSizeDistributionParam2Sector = temp;
                }
            }

            requestSizeGenerationSeed   = ++seed;
            randomRequestSizeGenerator  = new RandomGenerator(requestSizeGenerationSeed);
            requestTypeGenerationSeed   = ++seed;
            randomRequestTypeGenerator  = new RandomGenerator(++requestTypeGenerationSeed);
            timeIntervalGenerationSeed  = ++seed;
            randomTimeIntervalGenerator = new RandomGenerator(timeIntervalGenerationSeed);
            addressGenerationSeed1      = ++seed;
            randomAddressGenerator1     = new RandomGenerator(addressGenerationSeed1);
        }