Changeset: e7557bff3004 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e7557bff3004
Modified Files:
        monetdb5/mal/mal_runtime.c
        monetdb5/modules/mal/sysmon.c
Branch: scatter
Log Message:

Use MB units in all situations. Also retrieve the mb statistics, which avoids
the cost of maintaining QRYqueue with every instruction.Statistics is captured
optimistically, by not putting a lock around the code in the interpreter.
Given the larg number of calls, this should be a problem.
given the large number of call this should not be an issue.


diffs (43 lines):

diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -270,7 +270,8 @@ runtimeProfileInit(Client cntxt, MalBlkP
        if (!GDKembedded())
                QRYqueue[qhead].username = GDKstrdup(cntxt->username);
        QRYqueue[qhead].idx = cntxt->idx;
-       QRYqueue[qhead].memory = (lng) (stk->memory / LL_CONSTANT(1048576)); /* 
Convert to MB */
+       /* give the MB upperbound by addition of 1 MB */
+       QRYqueue[qhead].memory = 1 + (lng) (stk->memory / 
LL_CONSTANT(1048576)); /* Convert to MB */
        QRYqueue[qhead].workers = (int) 1;      /* this is the first one */
        QRYqueue[qhead].status = "running";
        QRYqueue[qhead].cntxt = cntxt;
@@ -304,7 +305,8 @@ runtimeProfileFinish(Client cntxt, MalBl
                        QRYqueue[i].status = "finished";
                        QRYqueue[i].finished = time(0);
                        QRYqueue[i].workers = mb->workers;
-                       QRYqueue[i].memory = mb->memory;
+                       /* give the MB upperbound by addition of 1 MB */
+                       QRYqueue[i].memory = 1 + (lng)(mb->memory / 
LL_CONSTANT(1048576));
                        QRYqueue[i].cntxt = 0;
                        QRYqueue[i].stk = 0;
                        QRYqueue[i].mb = 0;
diff --git a/monetdb5/modules/mal/sysmon.c b/monetdb5/modules/mal/sysmon.c
--- a/monetdb5/modules/mal/sysmon.c
+++ b/monetdb5/modules/mal/sysmon.c
@@ -234,8 +234,14 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, 
                        if (BUNappend(finished, &tsn, false) != GDK_SUCCEED)
                                goto bailout;
 
-                       wrk = QRYqueue[i].workers;
-                       mem = QRYqueue[i].memory;
+                       if( QRYqueue[i].mb)
+                               wrk = QRYqueue[i].mb->workers;
+                       else
+                               wrk = QRYqueue[i].workers;
+                       if( QRYqueue[i].mb)
+                               mem = 1 + QRYqueue[i].mb->memory / 
LL_CONSTANT(1048576);
+                       else
+                               mem = QRYqueue[i].memory;
                        if ( BUNappend(workers, &wrk, false) != GDK_SUCCEED ||
                                 BUNappend(memory, &mem, false) != GDK_SUCCEED)
                                goto bailout;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to