Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11790/src/mal

Modified Files:
      Tag: MonetDB_5-4
        mal_debugger.mx mal_interpreter.mx mal_profiler.mx 
Log Message:
Changed the way we check for and use mallinfo(): If mallinfo() returns
a struct with fields which are too small to hold the information it is
supposed to return (e.g. 32 bits on a 64-bit system), we ignore
mallinfo().  Also, we use our own struct to hold the information, so
that the rest of the software can rely on bot the presence of the
struct and the types of the fields.  

This also results in one interface change: the view_gdk_memory() and
memory() functions in M4 and the memStatistics() function in M5 now
return a BAT with a wrd tail instead of int.


Index: mal_profiler.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_profiler.mx,v
retrieving revision 1.102.2.5
retrieving revision 1.102.2.6
diff -u -d -r1.102.2.5 -r1.102.2.6
--- mal_profiler.mx     11 Feb 2008 12:00:18 -0000      1.102.2.5
+++ mal_profiler.mx     12 Feb 2008 09:26:00 -0000      1.102.2.6
@@ -180,7 +180,7 @@
 #endif
 
 typedef struct tms Tms;
-typedef struct mallinfo Mallinfo;
+typedef struct Mallinfo Mallinfo;
 
 mal_export str activateCounter(str name);
 mal_export str deactivateCounter(str name);
@@ -438,7 +438,7 @@
 void
 offlineProfilerEvent(Module cntxt, MalBlkPtr mb, MalStkPtr stk, int pc)
 {
-       static struct mallinfo prevMalloc;
+       static struct Mallinfo prevMalloc;
        InstrPtr pci = getInstrPtr(mb,pc);
 
 #ifdef HAVE_SYS_RESOURCE_H
@@ -449,7 +449,7 @@
 #ifdef HAVE_TIMES
        struct tms newTms;
 #endif
-       struct mallinfo infoMalloc;
+       struct Mallinfo infoMalloc;
        str stmt, c;
 
        (void) cntxt;
@@ -524,13 +524,13 @@
 #ifdef HAVE_SYS_RESOURCE_H
                log("%d,\t", infoUsage.ru_maxrss);
 #endif
-               log("%d,\t", infoMalloc.arena - prevMalloc.arena);
-               log("%d,\t", infoMalloc.ordblks - prevMalloc.ordblks);
-               log("%d,\t", infoMalloc.smblks - prevMalloc.smblks);
-               log("%d,\t", infoMalloc.hblkhd - prevMalloc.hblkhd);
-               log("%d,\t", infoMalloc.hblks - prevMalloc.hblks);
-               log("%d,\t", infoMalloc.fsmblks - prevMalloc.fsmblks);
-               log("%d,\t", infoMalloc.uordblks - prevMalloc.uordblks);
+               log(SZFMT ",\t", (size_t) (infoMalloc.arena - 
prevMalloc.arena));
+               log(SZFMT ",\t", (size_t) (infoMalloc.ordblks - 
prevMalloc.ordblks));
+               log(SZFMT ",\t", (size_t) (infoMalloc.smblks - 
prevMalloc.smblks));
+               log(SZFMT ",\t", (size_t) (infoMalloc.hblkhd - 
prevMalloc.hblkhd));
+               log(SZFMT ",\t", (size_t) (infoMalloc.hblks - 
prevMalloc.hblks));
+               log(SZFMT ",\t", (size_t) (infoMalloc.fsmblks - 
prevMalloc.fsmblks));
+               log(SZFMT ",\t", (size_t) (infoMalloc.uordblks - 
prevMalloc.uordblks));
                prevMalloc = infoMalloc;
        }
 #ifdef HAVE_SYS_RESOURCE_H
@@ -1012,14 +1012,14 @@
 void
 cachedProfilerEvent(Module cntxt, MalBlkPtr mb, MalStkPtr stk, int pc)
 {
-       /* static struct mallinfo prevMalloc; */
+       /* static struct Mallinfo prevMalloc; */
        /* static struct rusage   prevUsage; */
        static int eventcounter;
 #ifdef HAVE_TIMES
        struct tms newTms;
 #endif
 
-       /* struct mallinfo infoMalloc; */
+       /* struct Mallinfo infoMalloc; */
 #ifdef HAVE_SYS_RESOURCE_H
        struct rusage infoUsage;
 #endif

Index: mal_debugger.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_debugger.mx,v
retrieving revision 1.218.2.1
retrieving revision 1.218.2.2
diff -u -d -r1.218.2.1 -r1.218.2.2
--- mal_debugger.mx     9 Feb 2008 22:31:47 -0000       1.218.2.1
+++ mal_debugger.mx     12 Feb 2008 09:26:00 -0000      1.218.2.2
@@ -960,18 +960,18 @@
                                if( strncmp("flow",b,1) == 0)
                                        cntxt->flags |= flowFlag;
                                if( strncmp("memory",b,1) == 0){
-                                       struct mallinfo memory;
+                                       struct Mallinfo memory;
                                        cntxt->flags |= memoryFlag;
                                        memory = MT_mallinfo();
-                                       stream_printf(out,"arena %d ordblks %d 
smblks %d "
-                                               " hblkhd %d hblks %d fsmblks %d 
uordblks %d\n",
-                                               memory.arena,
-                                               memory.ordblks,
-                                               memory.smblks,
-                                               memory.hblkhd,
-                                               memory.hblks,
-                                               memory.fsmblks,
-                                               memory.uordblks
+                                       stream_printf(out,"arena " SZFMT " 
ordblks " SZFMT " smblks " SZFMT " "
+                                               " hblkhd " SZFMT " hblks " 
SZFMT " fsmblks " SZFMT " uordblks " SZFMT "\n",
+                                               (size_t) memory.arena,
+                                               (size_t) memory.ordblks,
+                                               (size_t) memory.smblks,
+                                               (size_t) memory.hblkhd,
+                                               (size_t) memory.hblks,
+                                               (size_t) memory.fsmblks,
+                                               (size_t) memory.uordblks
                                        );
                                }
                                if (strncmp("timer", b, 1) == 0) {

Index: mal_interpreter.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_interpreter.mx,v
retrieving revision 1.209.2.2
retrieving revision 1.209.2.3
diff -u -d -r1.209.2.2 -r1.209.2.3
--- mal_interpreter.mx  10 Feb 2008 06:06:45 -0000      1.209.2.2
+++ mal_interpreter.mx  12 Feb 2008 09:26:00 -0000      1.209.2.3
@@ -437,7 +437,7 @@
        bat *backup= (bat*) alloca(mb->maxarg * sizeof(bat));
        str *sbackup= (str*) alloca(mb->maxarg * sizeof(str));
        lng oldtimer=0;
-       struct mallinfo oldMemory;
+       struct Mallinfo oldMemory;
        int stkpc=0;
 
 #ifdef HAVE_SYS_RESOURCE_H
@@ -623,7 +623,7 @@
        bat *backup= (bat*) alloca(mb->maxarg * sizeof(bat));
        str *sbackup= (str*) alloca(mb->maxarg * sizeof(str));
        lng oldtimer=0;
-       struct mallinfo oldMemory;
+       struct Mallinfo oldMemory;
        int stkpc=0;
 
 #ifdef HAVE_SYS_RESOURCE_H
@@ -1641,11 +1641,11 @@
        }
 #endif
        if( cntxt->flags & memoryFlag){
-               struct mallinfo memory;
+               struct Mallinfo memory;
                memory= MT_mallinfo();
                if( memory.arena- oldMemory.arena > 0)
-                       stream_printf(cntxt->fdout," %6d bytes ",
-                               memory.arena-oldMemory.arena );
+                       stream_printf(cntxt->fdout," " SZFMT " bytes ",
+                               (size_t) (memory.arena-oldMemory.arena) );
        }
        if( cntxt->flags & flowFlag){
                /* calculate the read/write byte flow */


-------------------------------------------------------------------------
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

Reply via email to