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

Collect the NUMA interthread dataflow details.


diffs (125 lines):

diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -162,6 +162,7 @@ typedef struct VARRECORD {
        int tmpindex;                           /* temporary variable */
        ValRecord value;
        int eolife;                                     /* pc index when it 
should be garbage collected */
+       int worker;                                     /* tread id of last 
worker producing it */
        int propc, maxprop;                     /* proc count and max number of 
properties */
        int prps[];                                     /* property array */
 } *VarPtr, VarRecord;
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -297,8 +297,9 @@ DFLOWworker(void *T)
        int id = (int) (t - workers);
        Thread thr;
        str error = 0;
-       int i,last;
+       int i,last, tid;
        Client cntxt;
+       InstrPtr p;
 
        thr = THRnew("DFLOWworker");
 
@@ -311,6 +312,7 @@ DFLOWworker(void *T)
                /* wait until we are allowed to start working */
                MT_sema_down(&t->s, "DFLOWworker");
        }
+       tid = THRgettid();
        while (1) {
                if (fnxt == 0) {
                        MT_lock_set(&dataflowLock, "DFLOWworker");
@@ -365,6 +367,10 @@ DFLOWworker(void *T)
                        /* release the memory claim */
                        MALadmission(-fe->argclaim, -fe->hotclaim);
 #endif
+                       /* update the numa information. keep the thread-id 
producing the value */
+                       p= getInstrPtr(flow->mb,fe->pc);
+                       for( i = 0; i < p->argc; i++)
+                               flow->mb->var[getArg(p,i)]->worker = tid;
 
                        MT_lock_set(&flow->flowlock, "DFLOWworker");
                        fe->state = DFLOWwrapup;
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
@@ -86,7 +86,8 @@ static struct {
        /*  19 */  { "flow", 0},
        /*  20 */  { "ping", 0},
        /*  21 */  { "footprint", 0},
-       /*  21 */  { 0, 0}
+       /*  22 */  { "numa", 0},
+       /*  23 */  { 0, 0}
 };
 
 int
@@ -141,6 +142,9 @@ activateCounter(str name)
        case 'm':
                profileCounter[PROFmemory].status = 1;
                break;
+       case 'n':
+               profileCounter[PROFnuma].status = 1;
+               break;
        case 'p':
                profileCounter[PROFprocess].status = 1;
                break;
@@ -312,6 +316,9 @@ offlineProfilerHeader(void)
        if (profileCounter[PROFfootprint].status) {
                logadd("footprint,\t");
        }
+       if (profileCounter[PROFnuma].status) {
+               logadd("numa,\t");
+       }
        if (profileCounter[PROFreads].status)
                logadd("blk reads,\t");
        if (profileCounter[PROFwrites].status)
@@ -454,6 +461,14 @@ offlineProfilerEvent(int idx, MalBlkPtr 
        if (profileCounter[PROFfootprint].status) {
                logadd(LLFMT",\t", stk->tmpspace);
        }
+       if (profileCounter[PROFnuma].status) {
+               int i;
+               logadd("\"");
+               for( i= pci->retc ; i < pci->argc; i++)
+               if( !isVarConstant(mb, getArg(pci,i)) && 
mb->var[getArg(pci,i)]->worker)
+                       logadd("@%d", mb->var[getArg(pci,i)]->worker);
+               logadd("\",\t");
+       }
 #ifdef HAVE_SYS_RESOURCE_H
        if ((profileCounter[PROFreads].status ||
                 profileCounter[PROFwrites].status) && delayswitch < 0) {
@@ -1447,6 +1462,12 @@ void profilerHeartbeatEvent(str msg, lng
 #endif
        if (profileCounter[PROFmemory].status && delayswitch < 0)
                logadd(SZFMT ",\t", MT_getrss()/1024/1024);
+       if (profileCounter[PROFfootprint].status)
+               logadd("0,\t");
+       if (profileCounter[PROFnuma].status){
+               logadd("\"");
+               logadd("\",\t");
+       }
 #ifdef HAVE_SYS_RESOURCE_H
        if ((profileCounter[PROFreads].status ||
                 profileCounter[PROFwrites].status) && delayswitch < 0) {
@@ -1454,8 +1475,6 @@ void profilerHeartbeatEvent(str msg, lng
                logadd("%ld,\t", infoUsage.ru_oublock - prevUsage.ru_oublock);
                prevUsage = infoUsage;
        }
-       if (profileCounter[PROFfootprint].status)
-               logadd("0,\t");
        if (profileCounter[PROFprocess].status && delayswitch < 0) {
                logadd("%ld,\t", infoUsage.ru_minflt - prevUsage.ru_minflt);
                logadd("%ld,\t", infoUsage.ru_majflt - prevUsage.ru_majflt);
diff --git a/monetdb5/mal/mal_profiler.h b/monetdb5/mal/mal_profiler.h
--- a/monetdb5/mal/mal_profiler.h
+++ b/monetdb5/mal/mal_profiler.h
@@ -56,6 +56,7 @@ typedef struct Mallinfo Mallinfo;
 #define PROFflow   19
 #define PROFping   20  /* heartbeat ping messages */
 #define PROFfootprint 21
+#define PROFnuma 22
 
 mal_export str activateCounter(str name);
 mal_export str deactivateCounter(str name);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to