Exemplo n.º 1
0
            //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
            }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
            //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
            }
Exemplo n.º 4
0
            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);

            }