Re: [Monetdb-developers] [Monetdb-checkins] MonetDB5/src/mal mal_recycle.mx, , 1.129, 1.130
Romulo Goncalves wrote:
Update of /cvsroot/monetdb/MonetDB5/src/mal In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13210
Modified Files: mal_recycle.mx Log Message: Use the correct types.
Sjoerd said: "The Right Thing To Do would be to use the correct types for everything. In this case, size_t for anything that counts bytes (such as recyclerUsedMemory and memLimit)."
I'll also say: use SZFMT and LLFMT in format strings to print values of type size_t and lng respectively. See how these tokens are used.
U mal_recycle.mx Index: mal_recycle.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- mal_recycle.mx 31 Jul 2008 08:56:54 -0000 1.129 +++ mal_recycle.mx 31 Jul 2008 11:19:08 -0000 1.130 @@ -106,8 +106,8 @@
mal_export int recycleClaim; mal_export int recycleCacheLimit; -mal_export lng recycleMemory; /* Units of memory permitted */ -mal_export lng recyclerUsedMemory; +mal_export size_t recycleMemory; /* Units of memory permitted */ +mal_export size_t recyclerUsedMemory; mal_export MT_Lock recycleLock; mal_export MalBlkPtr recycleBlk; mal_export double recycleAlpha; @@ -196,7 +196,7 @@ RCACHE_MEMCRD: reduce the storage overhead */ int recycleCacheLimit=0; /* No limit by default */ int recycleClaim=0; /* avoid stale tables by letting users mark it */ -lng recycleMemory=0; /* Units of memory permitted */ +size_t recycleMemory=0; /* Units of memory permitted */ @- The profiler record is re-used to store recycler information. The clk is used by the LRU scheme, counter is the number of @@ -214,7 +214,7 @@
@- Monitoring the Recycler @c -lng recyclerUsedMemory = 0; +size_t recyclerUsedMemory = 0; int statements = 0; /* total number of statements executed */ int recycled = 0; /* total number of statements recycled */ int retained = 0; /* total number of statements retained */ @@ -487,7 +487,7 @@ int cont, reserve; lng oldclk, newclk; dbl mincrd, crd; - lng memLimit = recycleMemory?recycleMemory:HARDLIMIT_MEM; + size_t memLimit = recycleMemory?recycleMemory:HARDLIMIT_MEM; #ifdef _DEBUG_CACHE_ Client cntxt= MCgetClient(); #endif @@ -682,7 +682,8 @@ ValRecord *v; ValRecord cst; InstrPtr q; - lng memLimit,cacheLimit; + size_t memLimit; + lng cacheLimit;
RECYCLEspace(); cacheLimit = recycleCacheLimit?recycleCacheLimit:HARDLIMIT_STMT; @@ -744,7 +745,7 @@ recyclerUsedMemory += wr; if (monitorRecycler == 1 ) fprintf(stderr, - "#memory=%lld, stop=%d, recycled=%d, retained=%d executed=%d saved=" LLFMT "\n", + "#memory=%lu, stop=%d, recycled=%d, retained=%d executed=%d saved=" LLFMT "\n", recyclerUsedMemory, recycleBlk->stop, recycled, retained, statements, savedTime); retained++; @@ -1026,7 +1027,8 @@ void RECYCLEexitImpl(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){ lng clk = 0; - lng memLimit, cacheLimit; + size_t memLimit; + lng cacheLimit; size_t rd = getVolume(stk,p, 1)/ RU +1; size_t wr = getVolume(stk,p, 0)/ RU +1; ValRecord *v; @@ -1041,10 +1043,10 @@ if ((v->vtype == TYPE_bat) && (BBP_status( *(int*)VALget(v)) & BBPPERSISTENT)) wr = 0;
- if (wr > memLimit) + if ( wr > memLimit) return; if (recycleBlk) - if ( recyclerUsedMemory + wr > memLimit || + if ( recyclerUsedMemory + wr > memLimit || recycleBlk->stop >= cacheLimit ){ RECYCLEcleanCache(wr); RECYCLEversion(cntxt,mb); @@ -1069,7 +1071,7 @@ { /* RETAIN_SIZE: size cost model */ if (recycleVolume && RECYCLEfind(cntxt,mb,stk,p)<0){ - if (rd+wr > recycleVolume){ + if ((lng) (rd+wr) > recycleVolume){ (void) RECYCLEnew(cntxt,mb, stk, p, rd, wr); #ifdef _DEBUG_RECYCLE_ stream_printf(cntxt->fdout,"RECYCLEexit size " SZFMT " " SZFMT "\n",rd,wr);
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- Sjoerd Mullender
participants (1)
-
Sjoerd Mullender