Changeset: 75e8990138fc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75e8990138fc
Modified Files:
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_profiler.h
Branch: Feb2013
Log Message:
Show when worker threads have no work
The heartbeat event structure is extended to also emit a message
if a worker thread is about to wait on an empty queue.
diffs (87 lines):
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
@@ -329,8 +329,13 @@ DFLOWworker(void *t)
MT_lock_unset(&flow->flowlock, "MALworker");
q_enqueue(flow->done, fe);
- if ( fnxt == 0)
- MALresourceFairness(flow->cntxt, flow->mb, usec);
+ if ( fnxt == 0) {
+ if (todo->last == 0)
+ profilerHeartbeatEvent("wait");
+ else
+ MALresourceFairness(flow->cntxt, flow->mb,
usec);
+
+ }
}
GDKfree(GDKerrbuf);
GDKsetbuf(0);
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
@@ -1307,7 +1307,8 @@ static int gatherCPULoad(void){
return 0;
}
-static void profilerHeartbeat(void *dummy){
+void profilerHeartbeatEvent(str msg)
+{
#ifdef HAVE_SYS_RESOURCE_H
static struct rusage prevUsage;
struct rusage infoUsage;
@@ -1318,12 +1319,14 @@ static void profilerHeartbeat(void *dumm
#ifdef HAVE_TIMES
struct tms newTms;
struct tms prevtimer;
+
+ if( hbdelay ==0 || eventstream == NULL )
+ return;
times(&prevtimer);
#endif
#ifdef HAVE_SYS_RESOURCE_H
getrusage(RUSAGE_SELF, &prevUsage);
#endif
- (void) dummy;
(void) gatherCPULoad();
gettimeofday(&tv,NULL);
//prevclock = (time_t) tv.tv_sec;
@@ -1361,7 +1364,7 @@ static void profilerHeartbeat(void *dumm
log("%d,\t", eventcounter);
}
if (profileCounter[PROFstart].status)
- log("\"ping\",\t");
+ log("\"%s\",\t",msg);
if (profileCounter[PROFtime].status) {
char *tbuf, *c;
tbuf = ctime(&clock);
@@ -1434,6 +1437,18 @@ static void profilerHeartbeat(void *dumm
flushLog();
MT_lock_unset(&mal_profileLock, "profileLock");
}
+}
+
+static void profilerHeartbeat(void *dummy)
+{
+ (void) dummy;
+ while (1){
+ /* wait until you need this info */
+ while( hbdelay ==0 || eventstream == NULL )
+ MT_sleep_ms(1000);
+ MT_sleep_ms(hbdelay);
+ profilerHeartbeatEvent("ping");
+ }
hbdelay = 0;
}
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
@@ -64,6 +64,7 @@ mal_export str closeProfilerStream(void)
mal_export void initProfiler(MalBlkPtr mb);
mal_export void profilerEvent(int idx, MalBlkPtr mb, MalStkPtr stk, int pc,
int start);
+mal_export void profilerHeartbeatEvent(str msg);
mal_export str setLogFile(stream *fd, Module cntxt, str fname);
mal_export str setLogStream(Module cntxt, str host, int port);
mal_export str setLogStreamStream(Module cntxt, stream *s);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list