Changeset: c14cf9b50bd0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c14cf9b50bd0
Modified Files:
        monetdb5/mal/mal.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_profiler.h
Branch: default
Log Message:

Move profiler initialization to its own routine


diffs (60 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -11,7 +11,7 @@
 #include <mal.h>
 
 char monet_cwd[PATHLENGTH] = { 0 };
-size_t monet_memory;
+size_t monet_memory = 0;
 char   monet_characteristics[PATHLENGTH];
 int mal_trace;         /* enable profile events on console */
 #ifdef HAVE_HGE
@@ -86,8 +86,7 @@ int mal_init(void){
        MCinit();
        if (mdbInit()) 
                return -1;
-       if (monet_memory == 0)
-               monet_memory = MT_npages() * MT_pagesize();
+       monet_memory = MT_npages() * MT_pagesize();
        initNamespace();
        initParser();
        initHeartbeat();
@@ -96,9 +95,7 @@ int mal_init(void){
        if( malBootstrap() == 0)
                return -1;
        /* set up the profiler if needed, output sent to console */
-       /* Use the same shortcuts as stethoscope */
-       if ( mal_trace ) 
-               openProfilerStream(mal_clients[0].fdout,0);
+       initProfiler();
        return 0;
 }
 /*
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -995,6 +995,12 @@ void setHeartbeat(int delay)
        ATOMIC_SET(hbdelay, (ATOMIC_TYPE) delay, mal_beatLock);
 }
 
+void initProfiler(void)
+{
+       if( mal_trace)
+               openProfilerStream(mal_clients[0].fdout,0);
+}
+
 void initHeartbeat(void)
 {
 #ifdef NEED_MT_LOCK_INIT
diff --git a/monetdb5/mal/mal_profiler.h b/monetdb5/mal/mal_profiler.h
--- a/monetdb5/mal/mal_profiler.h
+++ b/monetdb5/mal/mal_profiler.h
@@ -23,6 +23,7 @@ typedef struct rusage Rusage;
 typedef struct tms Tms;
 typedef struct Mallinfo Mallinfo;
 
+mal_export void initProfiler(void);
 mal_export str openProfilerStream(stream *fd, int mode);
 mal_export str closeProfilerStream(void);
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to