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); } }
public FlowInformation(uint maxCapacity, StreamPriorityClass priorityClass) { MaxCapacity = maxCapacity; PriorityClass = priorityClass; }
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); }