//XXXIS add more things if we need them? public EssesFlowCacheContext(Flow flow, UInt64 cacheSizeAllocated, CacheWritePolicy writePolicy, CacheWriteBuffer cacheWrites, string cacheCurvePointsFile, string tenantID) { Flow = flow; this.cacheSizeAllocated = cacheSizeAllocated; this.writePolicy = writePolicy; this.cacheWrites = cacheWrites; this.hitRate = 0.0F; this.tenantID = tenantID; this.demandPointsSerializationFile = cacheCurvePointsFile; if (File.Exists(this.demandPointsSerializationFile)) { readInCacheCurve(); this.useSerializedCurve = true; } else { this.cacheDemandCurvePoints = null; this.cacheDemandFunc = null; this.useSerializedCurve = false; } #if COLLECT_CACHE_CURVE Console.CancelKeyPress += new ConsoleCancelEventHandler(Controller_CancelKeyPress); #endif }
private void readInCacheCurve() { string[] lines = System.IO.File.ReadAllLines(this.demandPointsSerializationFile); Double[] xVals = new Double[lines.Length]; Double[] yVals = new Double[lines.Length]; int i = 0; foreach (string inputRecord in lines) { string[] inputTokens = inputRecord.Split(','); xVals[i] = Convert.ToDouble(inputTokens[0]); yVals[i] = Convert.ToDouble(inputTokens[1]); i++; } this.cacheDemandCurvePoints = new CacheCurvePoints(xVals, yVals); //this.cacheDemandFunc = Interpolate.LinearBetweenPoints(this.cacheDemandCurvePoints.xVals, this.cacheDemandCurvePoints.yVals); //this.cacheDemandFunc = Interpolate.Linear(this.cacheDemandCurvePoints.xVals, this.cacheDemandCurvePoints.yVals); this.cacheDemandFunc = Interpolate.PolynomialEquidistant(this.cacheDemandCurvePoints.xVals, this.cacheDemandCurvePoints.yVals); }
//XXXIS add more things if we need them? public EssesFlowCacheContext(Flow flow, UInt64 cacheSizeAllocated, CacheWritePolicy writePolicy, CacheWriteBuffer cacheWrites, string cacheCurvePointsFile, string tenantID) { Flow = flow; this.cacheSizeAllocated = cacheSizeAllocated; this.writePolicy = writePolicy; this.cacheWrites = cacheWrites; this.hitRate = 0.0F; this.tenantID = tenantID; this.demandPointsSerializationFile = cacheCurvePointsFile; if (File.Exists(this.demandPointsSerializationFile)) { readInCacheCurve(); this.useSerializedCurve = true; } else { this.cacheDemandCurvePoints = null; this.cacheDemandFunc = null; this.useSerializedCurve = false; } #if COLLECT_CACHE_CURVE Console.CancelKeyPress += new ConsoleCancelEventHandler(Controller_CancelKeyPress); #endif }
private void readInCacheCurve() { string[] lines = System.IO.File.ReadAllLines(this.demandPointsSerializationFile); Double[] xVals = new Double[lines.Length]; Double[] yVals = new Double[lines.Length]; int i = 0; foreach (string inputRecord in lines) { string[] inputTokens = inputRecord.Split(','); xVals[i] = Convert.ToDouble(inputTokens[0]); yVals[i] = Convert.ToDouble(inputTokens[1]); i++; } this.cacheDemandCurvePoints = new CacheCurvePoints(xVals, yVals); //this.cacheDemandFunc = Interpolate.LinearBetweenPoints(this.cacheDemandCurvePoints.xVals, this.cacheDemandCurvePoints.yVals); //this.cacheDemandFunc = Interpolate.Linear(this.cacheDemandCurvePoints.xVals, this.cacheDemandCurvePoints.yVals); this.cacheDemandFunc = Interpolate.PolynomialEquidistant(this.cacheDemandCurvePoints.xVals, this.cacheDemandCurvePoints.yVals); }