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

MAL concurrency level counter
It helps in determining the number concurrent queries currently being executed.


diffs (42 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,7 @@
 #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 +371,9 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
                 * been 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;
        ret = runMALsequence(cntxt, mb, 1, 0, stk, env, 0);
@@ -382,6 +386,9 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
        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 && GDKms() > 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,5 +52,7 @@ mal_export str catchKernelException(Clie
 
 mal_export ptr getArgReference(MalStkPtr stk, InstrPtr pci, int k);
 
+mal_export int mal_concurreny_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