00001 /* 00002 // $Id: //open/dev/fennel/cache/CacheParams.cpp#10 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2005-2009 The Eigenbase Project 00005 // Copyright (C) 2005-2009 SQLstream, Inc. 00006 // Copyright (C) 2005-2009 LucidEra, Inc. 00007 // Portions Copyright (C) 1999-2009 John V. Sichi 00008 // 00009 // This program is free software; you can redistribute it and/or modify it 00010 // under the terms of the GNU General Public License as published by the Free 00011 // Software Foundation; either version 2 of the License, or (at your option) 00012 // any later version approved by The Eigenbase Project. 00013 // 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with this program; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #include "fennel/common/CommonPreamble.h" 00025 #include "fennel/cache/CacheParams.h" 00026 #include "fennel/common/ConfigMap.h" 00027 00028 FENNEL_BEGIN_CPPFILE("$Id: //open/dev/fennel/cache/CacheParams.cpp#10 $"); 00029 00030 ParamName CacheParams::paramMaxPages = "cachePagesMax"; 00031 ParamName CacheParams::paramPagesInit = "cachePagesInit"; 00032 ParamName CacheParams::paramPageSize = "cachePageSize"; 00033 ParamName CacheParams::paramIdleFlushInterval = "cacheIdleFlushInterval"; 00034 ParamName CacheParams::paramFreshmenQueuePercentage = 00035 "freshmenPageQueuePercentage"; 00036 ParamName CacheParams::paramPageHistoryQueuePercentage = 00037 "pageHistoryQueuePercentage"; 00038 ParamName CacheParams::paramPrefetchPagesMax = 00039 "prefetchPagesMax"; 00040 ParamName CacheParams::paramPrefetchThrottleRate = "prefetchThrottleRate"; 00041 00042 uint CacheParams::defaultMemPagesMax = 1024; 00043 uint CacheParams::defaultMemPagesInit = MAXU; 00044 uint CacheParams::defaultPageSize = 4096; 00045 uint CacheParams::defaultIdleFlushInterval = 100; 00046 uint CacheParams::defaultFreshmenQueuePercentage = 25; 00047 uint CacheParams::defaultPageHistoryQueuePercentage = 100; 00048 uint CacheParams::defaultPrefetchPagesMax = 12; 00049 uint CacheParams::defaultPrefetchThrottleRate = 10; 00050 00051 CacheParams::CacheParams() 00052 { 00053 nMemPagesMax = defaultMemPagesMax; 00054 cbPage = defaultPageSize; 00055 nMemPagesInit = defaultMemPagesInit; 00056 idleFlushInterval = defaultIdleFlushInterval; 00057 freshmenQueuePercentage = defaultFreshmenQueuePercentage; 00058 pageHistoryQueuePercentage = defaultPageHistoryQueuePercentage; 00059 prefetchPagesMax = defaultPrefetchPagesMax; 00060 prefetchThrottleRate = defaultPrefetchThrottleRate; 00061 } 00062 00063 void CacheParams::readConfig(ConfigMap const &configMap) 00064 { 00065 schedParams.readConfig(configMap); 00066 nMemPagesMax = configMap.getIntParam( 00067 paramMaxPages,nMemPagesMax); 00068 cbPage = configMap.getIntParam( 00069 paramPageSize,cbPage); 00070 nMemPagesInit = configMap.getIntParam( 00071 paramPagesInit,nMemPagesInit); 00072 if (!isMAXU(nMemPagesInit)) { 00073 if (nMemPagesMax < nMemPagesInit) { 00074 nMemPagesMax = nMemPagesInit; 00075 } 00076 } 00077 idleFlushInterval = configMap.getIntParam( 00078 paramIdleFlushInterval,idleFlushInterval); 00079 freshmenQueuePercentage = configMap.getIntParam( 00080 paramFreshmenQueuePercentage,freshmenQueuePercentage); 00081 pageHistoryQueuePercentage = configMap.getIntParam( 00082 paramPageHistoryQueuePercentage,pageHistoryQueuePercentage); 00083 prefetchPagesMax = configMap.getIntParam( 00084 paramPrefetchPagesMax,prefetchPagesMax); 00085 prefetchThrottleRate = configMap.getIntParam( 00086 paramPrefetchThrottleRate,prefetchThrottleRate); 00087 } 00088 00089 FENNEL_END_CPPFILE("$Id: //open/dev/fennel/cache/CacheParams.cpp#10 $"); 00090 00091 // End CacheParams.cpp