Changeset: df212139f6b4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=df212139f6b4
Modified Files:
monetdb5/mal/mal_interpreter.mx
monetdb5/mal/mal_runtime.c
monetdb5/mal/mal_runtime.h
Branch: default
Log Message:
Finalize performance helper
The stack pc was not handled properly.
diffs (165 lines):
diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -459,10 +459,8 @@ str runMALsequence(Client cntxt, MalBlkP
oldtimer = cntxt->timer = GDKusec();
/* also produce event record for start of function */
- if ( startpc == 1 ) {
- stkpc = 0;
- runtimeProfileBegin(cntxt, mb, stk, stkpc, &runtimeProfile, 1);
- }
+ if ( startpc == 1 )
+ runtimeProfileBegin(cntxt, mb, stk, 0, &runtimeProfile, 1);
stkpc = startpc;
exceptionVar = -1;
/*
@@ -532,7 +530,7 @@ workslow:
@:MALinterpret(SLOW)@
}
@:MALflowofcontrol(SLOW,continue)@
- runtimeProfileExit(cntxt, mb, stk, stkpc,
&runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec
> cntxt->qtimeout)
throw(MAL, "mal.interpreter",
RUNTIME_QRY_TIMEOUT);
}
@@ -1018,7 +1016,7 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
NULL, "unkown operation");
}
}
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
if (ret)
@@ -1586,9 +1584,9 @@ safeguardStack(Client cntxt, MalBlkPtr m
if (pcicaller && garbageControl(getInstrPtr(mb, 0)))
garbageCollector(cntxt, mb, stk, TRUE);
#if @1
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
runtimeProfile.ppc = 0; /* also finalize function call event */
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
#endif
@@ -1602,7 +1600,7 @@ safeguardStack(Client cntxt, MalBlkPtr m
ret = createScriptException(mb, stkpc, MAL,
NULL, "unkown operation");
#if @1
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
#endif
@@ -1721,7 +1719,7 @@ safeguardStack(Client cntxt, MalBlkPtr m
/* a fake multi-assignment */
if (env != NULL && pcicaller != NULL) {
InstrPtr pp = pci;
- runtimeProfileExit(cntxt, mb, stk, stkpc,
&runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec
> cntxt->qtimeout)
throw(MAL, "mal.interpreter",
RUNTIME_QRY_TIMEOUT);
pci = pcicaller;
@@ -1738,7 +1736,7 @@ safeguardStack(Client cntxt, MalBlkPtr m
if (oldtimer)
cntxt->timer = oldtimer;
} else {
- runtimeProfileExit(cntxt, mb, stk, stkpc,
&runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec
> cntxt->qtimeout)
throw(MAL, "mal.interpreter",
RUNTIME_QRY_TIMEOUT);
}
@@ -2290,9 +2288,9 @@ safeguardStack(Client cntxt, MalBlkPtr m
}
}
if (stkpc == mb->stop) {
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
runtimeProfile.ppc = 0; /* also finalize function call event */
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
@2;
@@ -2426,7 +2424,7 @@ if (ret != MAL_SUCCEED) {
/* unknown exceptions lead to propagation */
if (exceptionVar == -1) {
- runtimeProfileExit(cntxt, mb, stk, stkpc, &runtimeProfile);
+ runtimeProfileExit(cntxt, mb, stk, &runtimeProfile);
if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec >
cntxt->qtimeout)
throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
stkpc = mb->stop;
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
@@ -38,6 +38,9 @@ runtimeProfileInit(MalBlkPtr mb, Runtime
prof->newclk=0;
prof->ppc= -2;
prof->tcs = 0;
+ prof->inblock = 0;
+ prof->oublock = 0;
+ prof->memory = MT_mallinfo();
if (malProfileMode ) {
setFilterOnBlock(mb, 0, 0);
prof->ppc = -1;
@@ -57,8 +60,8 @@ runtimeProfileBegin(Client cntxt, MalBlk
mb->profiler[stkpc].ticks= 0;
mb->profiler[stkpc].clock= stk->clock;
/* emit the instruction upon start as well */
- if ( start )
- profilerEvent(cntxt->idx,mb,stk,stkpc,1);
+ if ( malProfileMode )
+ profilerEvent(cntxt->idx,mb,stk,stkpc,start);
#ifdef HAVE_TIMES
times(&stk->timer);
mb->profiler[stkpc].timer= stk->timer;
@@ -71,8 +74,9 @@ runtimeProfileBegin(Client cntxt, MalBlk
inline void
-runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int stkpc,
RuntimeProfile prof)
+runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, RuntimeProfile
prof)
{
+ int stkpc = prof->ppc;
if( malProfileMode == 0)
/* mostly true */;
else
@@ -95,9 +99,9 @@ void
runtimeTiming(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int tid
, MT_Lock *lock, RuntimeProfile prof)
{
str line;
- if (lock)
- MT_lock_set(&*lock, "timing");
if( cntxt->flags && stk->cmd != 't' && stk->cmd != 'C'){
+ if (lock)
+ MT_lock_set(&*lock, "timing");
mnstr_printf(cntxt->fdout,"= "); /* single column
rendering */
if( cntxt->flags & timerFlag){
char buf[32];
@@ -149,9 +153,9 @@ runtimeTiming(Client cntxt, MalBlkPtr mb
}
if( cntxt->flags & timerFlag)
cntxt->timer = GDKusec();
+ if (lock)
+ MT_lock_unset(&*lock, "timing");
}
- if (lock)
- MT_lock_unset(&*lock, "timing");
}
/*
* For performance evaluation it is handy to know the
diff --git a/monetdb5/mal/mal_runtime.h b/monetdb5/mal/mal_runtime.h
--- a/monetdb5/mal/mal_runtime.h
+++ b/monetdb5/mal/mal_runtime.h
@@ -37,7 +37,7 @@ typedef struct{
mal_export void runtimeProfileInit(MalBlkPtr mb, RuntimeProfile prof);
mal_export void runtimeProfileBegin(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
int stkpc, RuntimeProfile prof, int start);
-mal_export void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
int stkpc, RuntimeProfile prof);
+mal_export void runtimeProfileExit(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
RuntimeProfile prof);
mal_export void runtimeTiming(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci, int tid, MT_Lock *lock, RuntimeProfile prof);
mal_export lng getVolume(MalStkPtr stk, InstrPtr pci, int rd);
mal_export void displayVolume(Client cntxt, lng vol);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list