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

MAL concurrency level counter.


diffs (46 lines):

diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -30,6 +30,8 @@
 #include "mal_recycle.h"
 #include "mal_type.h"
 
+int mal_concurrency_level=0;
+
 /*
  * The struct alignment leads to 40% gain in simple instructions when set.
  */
@@ -370,6 +372,10 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
  * observed due the small size of the function).
  */
        }
+       
+       MT_lock_set(&mal_delayLock, "concurrency level counter");
+       mal_concurrency_level++;
+       MT_lock_unset(&mal_delayLock, "concurrency level counter");
 
        if (stk->cmd && env && stk->cmd != 'f')
                stk->cmd = env->cmd;
@@ -385,6 +391,11 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
                garbageCollector(cntxt, mb, stk, env != stk);
        if (stk && stk != env)
                GDKfree(stk);
+
+       MT_lock_set(&mal_delayLock, "concurrency level counter");
+       mal_concurrency_level--;
+       MT_lock_unset(&mal_delayLock, "concurrency level counter");
+
        if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec > 
cntxt->qtimeout)
                throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
        return ret;
diff --git a/monetdb5/mal/mal_interpreter.h b/monetdb5/mal/mal_interpreter.h
--- a/monetdb5/mal/mal_interpreter.h
+++ b/monetdb5/mal/mal_interpreter.h
@@ -52,6 +52,6 @@ mal_export str safeguardStack(Client cnt
 mal_export str catchKernelException(Client cntxt, str ret);
 
 mal_export ptr getArgReference(MalStkPtr stk, InstrPtr pci, int k);
-
+mal_export int mal_concurrency_level;
 #define FREE_EXCEPTION(p) do { if (p && p != M5OutOfMemory) GDKfree(p); } 
while (0)
 #endif /*  _MAL_INTERPRET_H*/
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to