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

Add a session uuid
to be able to differentiate amongst sessions, no matter
if they are concurrent or from the past.


diffs (65 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -10,10 +10,12 @@
 #include <monetdb_config.h>
 #include <mal.h>
 
-char monet_cwd[PATHLENGTH] = { 0 };
-size_t monet_memory = 0;
+char   monet_cwd[PATHLENGTH] = { 0 };
+size_t         monet_memory = 0;
 char   monet_characteristics[PATHLENGTH];
-int mal_trace;         /* enable profile events on console */
+int            mal_trace;              /* enable profile events on console */
+str     mal_session_uuid;   /* unique marker for the session */
+
 #ifdef HAVE_HGE
 int have_hge;
 #endif
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -52,6 +52,7 @@ mal_export char       monet_characteristics[P
 mal_export lng                 memorypool;      /* memory claimed by 
concurrent threads */
 mal_export int                 memoryclaims;    /* number of threads active 
with expensive operations */
 mal_export int         mal_trace;              /* enable profile events on 
console */
+mal_export str         mal_session_uuid;       /* unique marker for the 
session */
 #ifdef HAVE_HGE
 mal_export int have_hge;
 #endif
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
@@ -147,6 +147,8 @@ renderProfilerEvent(MalBlkPtr mb, MalStk
        logadd("\"function\":\"%s.%s\",%s", getModuleId(getInstrPtr(mb, 0)), 
getFunctionId(getInstrPtr(mb, 0)), prettify);
        logadd("\"pc\":%d,%s", mb?getPC(mb,pci):0, prettify);
        logadd("\"tag\":%d,%s", stk?stk->tag:0, prettify);
+       if( mal_session_uuid)
+               logadd("\"session\":%s,%s",mal_session_uuid,prettify);
 
        if( start){
                logadd("\"state\":\"start\",%s", prettify);
diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c
--- a/monetdb5/modules/atoms/uuid.c
+++ b/monetdb5/modules/atoms/uuid.c
@@ -61,13 +61,19 @@ mal_export str UUIDisaUUID(bit *retval, 
 mal_export str UUIDequal(bit *retval, uuid **l, uuid **r);
 
 static uuid uuid_nil;                  /* automatically initialized as zeros */
+static uuid *uuid_session;             /* automatically set during system 
restart */
 
 str
 UUIDprelude(void *ret)
 {
+       int len = 0;
+
        (void) ret;
        assert(UUID_SIZE == 16);
        (void) malAtomSize(sizeof(uuid), sizeof(oid), "uuid");
+       UUIDgenerateUuid(&uuid_session);
+       UUIDtoString(&mal_session_uuid, &len, uuid_session);
+       //mnstr_printf(GDKerr,"Session uid:%s", uuid_session_name);
        return MAL_SUCCEED;
 }
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to