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

Debugging aid: pass name of function that (un)locks, not name of lock.


diffs (256 lines):

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
@@ -171,7 +171,7 @@ deactivateCounter(str name)
 
 static void logsend(int header, char *logbuffer)
 {
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "logsend");
        if (eventstream) {
                if ( header)
                        mnstr_printf(eventstream,"%s\n", logbuffer);
@@ -183,7 +183,7 @@ static void logsend(int header, char *lo
                mnstr_flush(eventstream);
        }
        eventcounter++;
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "logsend");
 }
 
 #define flushLog() if (eventstream) mnstr_flush(eventstream);
@@ -200,9 +200,9 @@ profilerEvent(int idx, MalBlkPtr mb, Mal
        if (mb->profiler == NULL) return;
        if (profileCounter[PROFdot].status == 1 && start && pc == 0){
                if (mb->dotfile == 0){
-                       MT_lock_set(&mal_profileLock, "profileLock");
+                       MT_lock_set(&mal_profileLock, "profilerEvent");
                        showFlowGraph(mb,stk,"stethoscope");
-                       MT_lock_unset(&mal_profileLock, "profileLock");
+                       MT_lock_unset(&mal_profileLock, "profilerEvent");
                }
        }
        if (profileCounter[PROFstart].status == 0 && start)
@@ -488,9 +488,9 @@ str
 setLogFile(stream *fd, Module mod, str fname)
 {
        (void)mod;      /* still unused */
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "setLogFile");
        if (eventstream ) {
-               MT_lock_unset(&mal_profileLock, "profileLock");
+               MT_lock_unset(&mal_profileLock, "setLogFile");
                throw(IO, "mal.profiler", "Log file already set");
        }
        if (strcmp(fname, "console") == 0)
@@ -500,10 +500,10 @@ setLogFile(stream *fd, Module mod, str f
        else
                eventstream = open_wastream(fname);
        if (eventstream == NULL) {
-               MT_lock_unset(&mal_profileLock, "profileLock");
+               MT_lock_unset(&mal_profileLock, "setLogFile");
                throw(IO, "mal.profiler", RUNTIME_STREAM_FAILED);
        }
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "setLogFile");
        return MAL_SUCCEED;
 }
 
@@ -511,13 +511,13 @@ str
 setLogStream(Module cntxt, str host, int port)
 {
        (void)cntxt;        /* still unused */
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "setLogStream");
        if ((eventstream = udp_wastream(host, port, "profileStream")) == NULL) {
-               MT_lock_unset(&mal_profileLock, "profileLock");
+               MT_lock_unset(&mal_profileLock, "setLogStream");
                throw(IO, "mal.profiler", RUNTIME_STREAM_FAILED);
        }
        eventstream = wbstream(eventstream, BUFSIZ);
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "setLogStream");
        return MAL_SUCCEED;
 }
 
@@ -525,13 +525,13 @@ str
 setLogStreamStream(Module cntxt, stream *s)
 {
        (void)cntxt;        /* still unused */
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "setLogStreamStream");
        if ((eventstream = s) == NULL) {
-               MT_lock_unset(&mal_profileLock, "profileLock");
+               MT_lock_unset(&mal_profileLock, "setLogStreamStream");
                throw(ILLARG, "mal.profiler", "stream must not be NULL");
        }
        eventstream = wbstream(eventstream, BUFSIZ);
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "setLogStreamStream");
        return MAL_SUCCEED;
 }
 
@@ -563,14 +563,14 @@ setStartPoint(Module cntxt, str mod, str
        (void)cntxt;
        (void)mod;
        (void)fcn;      /* still unused */
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "setStartPoint");
        if (eventstream == NULL) {
-               MT_lock_unset(&mal_profileLock, "profileLock");
+               MT_lock_unset(&mal_profileLock, "setStartPoint");
                return MAL_SUCCEED ;
        }
        mnstr_printf(GDKout, "# start point not set\n");
        flushLog();
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "setStartPoint");
        return MAL_SUCCEED;
 }
 
@@ -580,14 +580,14 @@ setEndPoint(Module cntxt, str mod, str f
        (void)cntxt;
        (void)mod;
        (void)fcn;      /* still unused */
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "setEndPoint");
        if (eventstream == NULL) {
-               MT_lock_unset(&mal_profileLock, "profileLock");
+               MT_lock_unset(&mal_profileLock, "setEndPoint");
                return MAL_SUCCEED ;
        }
        mnstr_printf(GDKout, "# end point not set\n");
        flushLog();
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "setEndPoint");
        return MAL_SUCCEED;
 }
 
@@ -600,7 +600,7 @@ static int TRACE_init = 0;
 str
 startProfiling(void)
 {
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "startProfiling");
        if (eventstream != NULL) {
                offlineProfiling = TRUE;
                delayswitch = 1;
@@ -610,19 +610,19 @@ startProfiling(void)
                _initTrace();
        malProfileMode = TRUE;
        eventcounter = 0;
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "startProfiling");
        return MAL_SUCCEED;
 }
 
 str
 stopProfiling(void)
 {
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "stopProfiling");
        malProfileMode = FALSE;
        offlineProfiling = FALSE;
        cachedProfiling = FALSE;
        closeProfilerStream();
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "stopProfiling");
        return MAL_SUCCEED;
 }
 
@@ -635,9 +635,9 @@ MPresetProfiler(stream *fdout)
 {
        if (fdout != eventstream)
                return;
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "MPresetProfiler");
        eventstream = 0;
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "MPresetProfiler");
 }
 
 /*
@@ -710,7 +710,7 @@ setFilter(Module cntxt, str mod, str fcn
                fcn = matchall;
        profileAll = strcmp(mod, "*") == 0 && strcmp(fcn, "*") == 0;
 
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "setFilter");
        if (mod && fcn && topFilter < 32) {
                modFilter[topFilter] = putName(mod, strlen(mod));
                fcnFilter[topFilter++] = putName(fcn, strlen(fcn));
@@ -726,7 +726,7 @@ setFilter(Module cntxt, str mod, str fcn
                                }
                s = s->outer;
        }
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "setFilter");
 }
 
 /*
@@ -745,7 +745,7 @@ clrFilter(Module cntxt, str mod, str fcn
        (void)mod;
        (void)fcn;      /* still unused */
 
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "clrFilter");
        for (j = 0; j < topFilter; j++) {
                modFilter[j] = NULL;
                fcnFilter[j] = NULL;
@@ -766,7 +766,7 @@ clrFilter(Module cntxt, str mod, str fcn
                                }
                s = s->outer;
        }
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "clrFilter");
 }
 /*
  * The instructions to be monitored can also be identified
@@ -835,7 +835,7 @@ TRACEtable(BAT **r)
 {
        if (initTrace())
                return ;
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "TRACEtable");
        r[0] = BATcopy(TRACE_id_event, TRACE_id_event->htype, 
TRACE_id_event->ttype, 0);
        r[1] = BATcopy(TRACE_id_time, TRACE_id_time->htype, 
TRACE_id_time->ttype, 0);
        r[2] = BATcopy(TRACE_id_pc, TRACE_id_pc->htype, TRACE_id_pc->ttype, 0);
@@ -848,7 +848,7 @@ TRACEtable(BAT **r)
        r[9] = BATcopy(TRACE_id_wbytes, TRACE_id_wbytes->htype, 
TRACE_id_wbytes->ttype, 0);
        r[10] = BATcopy(TRACE_id_type, TRACE_id_type->htype, 
TRACE_id_type->ttype, 0);
        r[11] = BATcopy(TRACE_id_stmt, TRACE_id_stmt->htype, 
TRACE_id_stmt->ttype, 0);
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "TRACEtable");
 }
 
 static BAT *
@@ -938,9 +938,9 @@ initTrace(void)
 {
        if (TRACE_init)
                return 0;       /* already initialized */
-       MT_lock_set(&mal_contextLock, "profileLock");
+       MT_lock_set(&mal_contextLock, "initTrace");
        _initTrace();
-       MT_lock_unset(&mal_contextLock, "profileLock");
+       MT_lock_unset(&mal_contextLock, "initTrace");
        return TRACE_init ? 0 : -1;
 }
 
@@ -1076,7 +1076,7 @@ cachedProfilerEvent(int idx, MalBlkPtr m
                getModuleId(getInstrPtr(mb, 0)),
                getFunctionId(getInstrPtr(mb, 0)), getPC(mb, pci));
 
-       MT_lock_set(&mal_profileLock, "profileLock");
+       MT_lock_set(&mal_profileLock, "cachedProfilerEvent");
        TRACE_id_pc = BUNappend(TRACE_id_pc, buf, FALSE);
 
        TRACE_id_thread = BUNappend(TRACE_id_thread, &tid, FALSE);
@@ -1140,7 +1140,7 @@ cachedProfilerEvent(int idx, MalBlkPtr m
        TRACE_id_wbytes = BUNappend(TRACE_id_wbytes, &mb->profiler[pc].wbytes, 
FALSE);
 
        eventcounter++;
-       MT_lock_unset(&mal_profileLock, "profileLock");
+       MT_lock_unset(&mal_profileLock, "cachedProfilerEvent");
 }
 /*
  * The profile vector is added to the MAL block the first time we
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to