Changeset: 1ff86d011363 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ff86d011363
Modified Files:
monetdb5/mal/mal_client.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_runtime.c
monetdb5/mal/mal_stack.h
monetdb5/modules/mal/clients.c
monetdb5/modules/mal/clients.mal
monetdb5/optimizer/opt_dataflow.c
Branch: default
Log Message:
Simplifying access during performance monitoring
diffs (227 lines):
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -95,8 +95,8 @@ typedef struct CLIENT {
#define footprintFlag 16
time_t login;
time_t lastcmd; /* set when input is received */
- int qtimeout; /* query abort after x seconds */
- int stimeout; /* session abort after x seconds */
+ lng qtimeout; /* query abort after x milliseconds */
+ lng stimeout; /* session abort after x milliseconds */
/*
* Communication channels for the interconnect are stored here.
* It is perfectly legal to have a client without input stream.
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
@@ -380,7 +380,7 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
if (stk && stk != env) {
GDKfree(stk);
}
- if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
+ if (cntxt->qtimeout && GDKms() > cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
return ret;
}
@@ -471,7 +471,7 @@ callMAL(Client cntxt, MalBlkPtr mb, MalS
throw(MAL, "mal.interpreter", RUNTIME_UNKNOWN_INSTRUCTION);
}
MT_sema_up(&mal_parallelism,"callMAL");
- if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
+ if (cntxt->qtimeout && GDKms() > cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
return ret;
}
@@ -544,7 +544,7 @@ str runMALsequence(Client cntxt, MalBlkP
runtimeProfileBegin(cntxt, mb, stk, stkpc, &runtimeProfile, 1);
if (pci->recycle > 0)
- stk->clk = GDKusec();
+ stk->clk = GDKms();
if (!RECYCLEentry(cntxt, mb, stk, pci)){
/* The interpreter loop
* The interpreter is geared towards execution a MAL procedure together
@@ -702,7 +702,7 @@ str runMALsequence(Client cntxt, MalBlkP
runtimeProfileFinish(cntxt, mb);
if (pcicaller && garbageControl(getInstrPtr(mb,
0)))
garbageCollector(cntxt, mb, stk, TRUE);
- if (cntxt->qtimeout && time(NULL) -
stk->clock.tv_usec > cntxt->qtimeout){
+ if (cntxt->qtimeout && GDKms() >
cntxt->qtimeout){
ret= createException(MAL,
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
break;
}
@@ -717,7 +717,7 @@ str runMALsequence(Client cntxt, MalBlkP
w= instruction2str(mb, 0, pci, FALSE);
ret = createScriptException(mb, stkpc, MAL,
NULL, "unkown operation:%s",w);
GDKfree(w);
- if (cntxt->qtimeout && time(NULL) -
stk->clock.tv_usec > cntxt->qtimeout){
+ if (cntxt->qtimeout && GDKms() >
cntxt->qtimeout){
ret= createException(MAL,
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
break;
}
@@ -852,7 +852,7 @@ str runMALsequence(Client cntxt, MalBlkP
if (exceptionVar == -1) {
runtimeProfileExit(cntxt, mb, stk, pci,
&runtimeProfile);
runtimeProfileFinish(cntxt, mb);
- if (cntxt->qtimeout && time(NULL) -
stk->clock.tv_usec > cntxt->qtimeout)
+ if (cntxt->qtimeout && GDKms() >
cntxt->qtimeout)
ret= createException(MAL,
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
stkpc = mb->stop;
continue;
@@ -899,7 +899,7 @@ str runMALsequence(Client cntxt, MalBlkP
}
}
if (stkpc == mb->stop) {
- if (cntxt->qtimeout && time(NULL) -
stk->clock.tv_usec > cntxt->qtimeout){
+ if (cntxt->qtimeout && GDKms() >
cntxt->qtimeout){
ret= createException(MAL,
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
stkpc = mb->stop;
}
@@ -1122,7 +1122,7 @@ str runMALsequence(Client cntxt, MalBlkP
default:
stkpc++;
}
- if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout){
+ if (cntxt->qtimeout && GDKms() > cntxt->qtimeout){
ret= createException(MAL, "mal.interpreter",
RUNTIME_QRY_TIMEOUT);
stkpc= mb->stop;
}
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
@@ -1333,7 +1333,6 @@ void profilerHeartbeatEvent(str msg)
#endif
struct timeval tv;
time_t clock;
- //time_t prevclock=0;
#ifdef HAVE_TIMES
struct tms newTms;
struct tms prevtimer;
@@ -1346,7 +1345,6 @@ void profilerHeartbeatEvent(str msg)
getrusage(RUSAGE_SELF, &prevUsage);
#endif
gettimeofday(&tv,NULL);
- //prevclock = (time_t) tv.tv_sec;
/* without this cast, compilation on Windows fails with
* argument of type "long *" is incompatible with parameter of type
"const time_t={__time64_t={__int64}} *"
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
@@ -132,12 +132,10 @@ runtimeProfileBegin(Client cntxt, MalBlk
prof->stkpc = stkpc;
if (stk && mb->profiler != NULL && mb->profiler[stkpc].trace) {
- MT_lock_set(&mal_delayLock, "sysmon");
prof->newclk = stk->clk = GDKusec();
- gettimeofday(&stk->clock, NULL);
mb->profiler[stkpc].clk = 0;
mb->profiler[stkpc].ticks = 0;
- mb->profiler[stkpc].clock = stk->clock;
+ gettimeofday(&mb->profiler[stkpc].clock, NULL);
/* emit the instruction upon start as well */
profilerEvent(cntxt->idx, mb, stk, stkpc, start);
#ifdef HAVE_TIMES
@@ -145,7 +143,6 @@ runtimeProfileBegin(Client cntxt, MalBlk
mb->profiler[stkpc].timer = stk->timer;
#endif
mb->profiler[stkpc].clk = prof->newclk;
- MT_lock_unset(&mal_delayLock, "sysmon");
}
}
@@ -173,7 +170,6 @@ runtimeProfileExit(Client cntxt, MalBlkP
if (stk != NULL && prof->stkpc >= 0 && mb->profiler != NULL &&
mb->profiler[stkpc].trace && mb->profiler[stkpc].clk) {
- MT_lock_set(&mal_contextLock, "sysmon");
gettimeofday(&mb->profiler[stkpc].clock, NULL);
mb->profiler[stkpc].counter++;
mb->profiler[stkpc].ticks = GDKusec() - prof->newclk;
@@ -184,7 +180,6 @@ runtimeProfileExit(Client cntxt, MalBlkP
mb->profiler[stkpc].wbytes = getVolume(stk, pci, 1);
}
profilerEvent(cntxt->idx, mb, stk, stkpc, 0);
- MT_lock_unset(&mal_contextLock, "sysmon");
}
}
diff --git a/monetdb5/mal/mal_stack.h b/monetdb5/mal/mal_stack.h
--- a/monetdb5/mal/mal_stack.h
+++ b/monetdb5/mal/mal_stack.h
@@ -58,8 +58,8 @@ typedef struct MALSTK {
#ifdef HAVE_TIMES
struct tms timer; /* timing information */
#endif
- struct timeval clock; /* seconds + microsecs since epoch */
- lng clk; /* micro seconds */
+ struct timeval clock; /* time this stack was created */
+ lng clk; /* micro seconds, used by ? */
char cmd; /* debugger and runtime communication */
char status; /* srunning 'R' uspended 'S', quiting 'Q' */
int pcup; /* saved pc upon a recursive all */
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -362,8 +362,8 @@ CLTsuspend(Client cntxt, MalBlkPtr mb, M
str
CLTsetTimeout(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- int qto= *(int *) getArgReference(stk,pci,1);
- int sto= *(int *) getArgReference(stk,pci,2);
+ lng qto= *(lng *) getArgReference(stk,pci,1);
+ lng sto= *(lng *) getArgReference(stk,pci,2);
(void) mb;
cntxt->qtimeout = qto;
cntxt->stimeout = sto;
@@ -372,8 +372,8 @@ CLTsetTimeout(Client cntxt, MalBlkPtr mb
str
CLTgetTimeout(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- int *qto= (int *) getArgReference(stk,pci,0);
- int *sto= (int *) getArgReference(stk,pci,1);
+ lng *qto= (lng *) getArgReference(stk,pci,0);
+ lng *sto= (lng *) getArgReference(stk,pci,1);
(void) mb;
*qto = cntxt->qtimeout;
*sto = cntxt->stimeout;
diff --git a/monetdb5/modules/mal/clients.mal b/monetdb5/modules/mal/clients.mal
--- a/monetdb5/modules/mal/clients.mal
+++ b/monetdb5/modules/mal/clients.mal
@@ -71,15 +71,15 @@ command wakeup(id:int):void
address CLTwakeup
comment "Wakeup a client process";
-pattern setTimeout(q:int,s:int):void
+pattern setTimeout(q:lng,s:lng):void
address CLTsetTimeout
-comment "Abort a query after q seconds (q=0 means run undisturbed).
+comment "Abort a query after q milliseconds (q=0 means run undisturbed).
The session timeout aborts the connection after spending too
many seconds on query processing.";
-pattern getTimeout()(q:int,s:int)
+pattern getTimeout()(q:lng,s:lng)
address CLTgetTimeout
-comment "A query is aborted after q seconds (q=0 means run undisturbed).
+comment "A query is aborted after q milliseconds (q=0 means run undisturbed).
The session timeout aborts the connection after spending too
many seconds on query processing.";
diff --git a/monetdb5/optimizer/opt_dataflow.c
b/monetdb5/optimizer/opt_dataflow.c
--- a/monetdb5/optimizer/opt_dataflow.c
+++ b/monetdb5/optimizer/opt_dataflow.c
@@ -139,8 +139,10 @@ dflowAssignConflict(InstrPtr p, int pc,
for(j=0; j<p->retc; j++)
if ( assigned[getArg(p,j)] )
return 1;
- if ( isUpdateInstruction(p) && eolife[getArg(p,p->retc)] != pc )
- return 1;
+ /* first argument of updates collect side-effects */
+ if ( isUpdateInstruction(p) ){
+ return eolife[getArg(p,p->retc)] != pc;
+ }
return 0;
}
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list