Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31873/mal
Modified Files:
mal_function.mx mal_recycle.mx
Log Message:
Added the recycle cache limit.
Permit additional integer arguments to steer the policies.
Approved the first recycle tests
Index: mal_recycle.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mal_recycle.mx 8 Mar 2008 08:11:49 -0000 1.14
+++ mal_recycle.mx 8 Mar 2008 11:57:40 -0000 1.15
@@ -68,7 +68,8 @@
extern int reusePolicy;
extern int rcachePolicy;
extern int recycleVersion; /* version of recycle table */
-extern int recycleUsers;
+extern int recycleClaim;
+extern int recycleCacheLimit;
extern MT_Lock recycleLock;
extern MalBlkPtr recycleBlk;
@@ -88,7 +89,8 @@
MT_Lock recycleLock ;
int recycleVersion = 0; /* version of recycle table */
MalBlkPtr recycleBlk = NULL;
-int recycleUsers=0;
+int recycleClaim=0;
+int recycleCacheLimit=0;
int retainPolicy = 0; /* recycle retainment policy
0: baseline, keeps stat, no retain, no reuse
@@ -150,6 +152,36 @@
}
}
@-
+The cache of recycled instructions can be kept low.
+Once the cache is filled, we have to drop instructions
+and associated variables. At the same time we should
+invalidate the cache version, such that others can
+re-synchronize.
+
+For the recycle cache LRU scheme we mis-use a field in
+the performance record.
[EMAIL PROTECTED]
+void RECYCLEcache(){
+ int i, max;
+
+ max= 0;
+ for(i=0; i< recycleBlk->stop; i++){
+ recycleBlk->profiler[i].ibytes++;
+ if( recycleBlk->profiler[max].ibytes
<recycleBlk->profiler[i].ibytes)
+ max = i;
+ }
+ if( recycleBlk->stop > recycleCacheLimit && recycleClaim <= 1){
+#ifdef _DEBUG_RECYCLE_
+ stream_printf(GDKout,"RECYCLE cache, remove %d \n",max);
+#endif
+ mal_set_lock(recycleLock,"recycle");
+ removeInstruction(recycleBlk,getInstrPtr(recycleBlk,max));
+ recycleVersion++;
+ mal_unset_lock(recycleLock,"recycle");
+ }
+}
+
[EMAIL PROTECTED]
The overloaded algebra operator simply calls the
underlying implementation and collects statistics on the
cost.
@@ -162,6 +194,9 @@
InstrPtr q;
RECYCLEspace();
+ if( recycleCacheLimit &&
+ recycleCacheLimit < recycleBlk->stop)
+ return; /* no more caching */
q = copyInstruction(p);
for(i = 0; i< p->argc; i++){
j= getArg(p,i);
@@ -174,7 +209,7 @@
mb->var[j]->recycle= c;
if( isVarRecycled(mb, j))
setVarKept(mb, j);
- setVarUsed(mb,j);
+ setVarUsed(recycleBlk,c);
}
}
i= recycleBlk->stop;
@@ -358,6 +393,8 @@
clk= GDKusec()-stk->clk;
#endif
+ if( recycleCacheLimit)
+ RECYCLEcache();
switch(retainPolicy){
case 0:
/* 0: baseline, keeps stat, no retain, no reuse */
Index: mal_function.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_function.mx,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- mal_function.mx 8 Feb 2008 22:36:31 -0000 1.154
+++ mal_function.mx 8 Mar 2008 11:57:39 -0000 1.155
@@ -628,6 +628,10 @@
@c
void printFunction(stream *fd, MalBlkPtr mb, int flg) {
int i;
+ if( mb == NULL){
+ stream_printf(fd, "# function definition missing\n");
+ return;
+ }
if (flg & LIST_MAPI) {
/* a bit dirty, but only here we have the number of lines */
stream_printf(fd, "&1 0 %d 1 %d\n", /* type id rows columns
tuples */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins