Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13472/src/mal
Modified Files:
Tag: GDK-2
mal_client.mx mal_instruction.mx mal_interpreter.mx
mal_sabaoth.mx mal_scenario.mx
Log Message:
propagated changes of Monday Sep 03 2007 - Thursday Sep 06 2007
from the development trunk to the GDK-2 branch
Index: mal_sabaoth.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_sabaoth.mx,v
retrieving revision 1.27.2.3
retrieving revision 1.27.2.4
diff -u -d -r1.27.2.3 -r1.27.2.4
--- mal_sabaoth.mx 3 Sep 2007 13:08:11 -0000 1.27.2.3
+++ mal_sabaoth.mx 6 Sep 2007 13:52:35 -0000 1.27.2.4
@@ -183,7 +183,7 @@
str SABAOTHretreatScenario(int *ret, str *lang) {
FILE *f;
str buf = alloca(sizeof(char) * 256); /* should be enough for now */
- int len;
+ size_t len;
str path = alloca(sizeof(char) * (PATHLENGTH + 1));
str tmp;
(void)ret;
@@ -215,7 +215,8 @@
fflush(tmp);
rewind(tmp);
len = fread(buf, 1, 256, tmp);
- fwrite(buf, 1, len, f);
+ if (fwrite(buf, 1, len, f) < len)
+ throw(IO, "sabaoth.retreatScenario",
"error while writing");
fflush(f);
fclose(f);
fclose(tmp); /* this should remove it
automagically */
Index: mal_client.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_client.mx,v
retrieving revision 1.154.2.2
retrieving revision 1.154.2.3
diff -u -d -r1.154.2.2 -r1.154.2.3
--- mal_client.mx 3 Sep 2007 13:08:07 -0000 1.154.2.2
+++ mal_client.mx 6 Sep 2007 13:52:35 -0000 1.154.2.3
@@ -89,6 +89,10 @@
# include <sys/resource.h>
#endif
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
@-
The prompt structure is designed to simplify recognition
of the language framework for interaction. For direct console
@@ -226,6 +230,18 @@
Symbol curprg; /* focus of parser */
Symbol backup; /* save parsing context */
MalStkPtr glb; /* global variable stack */
[EMAIL PROTECTED]
+Some statistics on client behavior becomes relevant
+for server maintenance. The scenario loop is used as
+a frame of reference. We measure the elapsed time after
+a request has been received and we have to wait for
+the next one.
[EMAIL PROTECTED]
+ int actions;
+ lng totaltime; /* sum of elapsed processing
times */
+#ifdef HAVE_TIMES
+ struct tms workload;
+#endif
} *Client, ClientRec;
mal_export ClientRec mal_clients[MAL_MAXCLIENTS+1];
@@ -446,6 +462,9 @@
prompt = !fin? GDKgetenv("monet_prompt"): PROMPT1;
c->prompt= GDKstrdup(prompt);
c->promptlength= strlen(prompt);
+
+ c->actions =0;
+ c->totaltime= 0;
return c;
}
@-
Index: mal_scenario.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_scenario.mx,v
retrieving revision 1.110.2.1
retrieving revision 1.110.2.2
diff -u -d -r1.110.2.1 -r1.110.2.2
--- mal_scenario.mx 3 Sep 2007 13:08:14 -0000 1.110.2.1
+++ mal_scenario.mx 6 Sep 2007 13:52:35 -0000 1.110.2.2
@@ -183,6 +183,10 @@
#include "mal_authorize.h"
#include "mal_exception.h"
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
struct SCENARIO scenarioRec[MAXSCEN] = {
{"mal", "mal",
0, 0, /* hardwired MALinit*/
@@ -576,15 +580,33 @@
runScenarioBody(Client c)
{
str msg= MAL_SUCCEED;
+ lng start;
+#ifdef HAVE_TIMES
+ struct tms t0,t1;
+#endif
while (c->mode > FINISHING) {
msg = MAL_SUCCEED;
@:runPhase(MAL_SCENARIO_READER)@
c->lastcmd= time(0);
+ start= GDKusec();
+#ifdef HAVE_TIMES
+ times(&t0);
+#endif
@:runPhase(MAL_SCENARIO_PARSER)@
@:runPhase(MAL_SCENARIO_OPTIMIZE)@
@:runPhase(MAL_SCENARIO_SCHEDULER)@
@:runPhase(MAL_SCENARIO_ENGINE)@
+ start= GDKusec()-start;
+ c->actions++;
+ c->totaltime += start;
+#ifdef HAVE_TIMES
+ times(&t1);
+ c->workload.tms_utime += t1.tms_utime-t0.tms_utime;
+ c->workload.tms_cutime += t1.tms_cutime-t0.tms_cutime;
+ c->workload.tms_stime += t1.tms_stime-t0.tms_stime;
+ c->workload.tms_cstime += t1.tms_cstime-t0.tms_cstime;
+#endif
}
return msg;
}
Index: mal_interpreter.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_interpreter.mx,v
retrieving revision 1.194.2.1
retrieving revision 1.194.2.2
diff -u -d -r1.194.2.1 -r1.194.2.2
--- mal_interpreter.mx 10 Aug 2007 14:54:49 -0000 1.194.2.1
+++ mal_interpreter.mx 6 Sep 2007 13:52:35 -0000 1.194.2.2
@@ -403,8 +403,8 @@
int exceptionVar, exceptionPC;
str ret=0;
int stamp= -1;
- int backup[MAXARG];
- str sbackup[MAXARG];
+ short *backup= (short*) alloca(mb->maxarg * sizeof(short));
+ str *sbackup= (str*) alloca(mb->maxarg * sizeof(str));
lng oldtimer=0;
struct mallinfo oldMemory;
#ifdef HAVE_SYS_RESOURCE_H
@@ -569,8 +569,8 @@
int exceptionVar, exceptionPC;
str ret=0;
int stamp= -1;
- int backup[MAXARG];
- str sbackup[MAXARG];
+ short *backup= (short*) alloca(mb->maxarg * sizeof(short));
+ str *sbackup= (str*) alloca(mb->maxarg * sizeof(str));
lng oldtimer=0;
struct mallinfo oldMemory;
#ifdef HAVE_SYS_RESOURCE_H
@@ -935,6 +935,7 @@
printInstruction(GDKout,mb,pci, LIST_MAL_ALL);
#endif
if( needsCleanup(pci) ){
+ assert(pci->retc <= mb->maxarg);
for(i=0; i<pci->retc; i++) {
sbackup[i]= 0;
backup[i]= 0;
Index: mal_instruction.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_instruction.mx,v
retrieving revision 1.282.2.3
retrieving revision 1.282.2.4
diff -u -d -r1.282.2.3 -r1.282.2.4
--- mal_instruction.mx 3 Sep 2007 13:08:08 -0000 1.282.2.3
+++ mal_instruction.mx 6 Sep 2007 13:52:35 -0000 1.282.2.4
@@ -366,7 +366,7 @@
str modname; /* module context */
str fcnname; /* function name */
short argc, retc, maxarg; /* total and result argument count */
- short argv[MAXARG]; /* at least a few entries */
+ short argv[]; /* at least a few entries */
} *InstrPtr, InstrRecord;
@-
@@ -407,6 +407,7 @@
struct MALBLK *history;/* of optimizer actions */
int keephistory; /* do we need the history at all */
str marker; /* history points are marked for
backtracking */
+ int maxarg; /* keep track on the maximal arguments
used */
} *MalBlkPtr, MalBlkRecord;
@-
@@ -644,6 +645,7 @@
mb->history = NULL;
mb->keephistory = 0;
mb->marker = 0;
+ mb->maxarg = MAXARG; /* the minimum for each instruction */
mb->typefixed = 0;
mb->flowfixed = 0;
mb->profiler = NULL;
@@ -746,6 +748,7 @@
mb->errors = old->errors;
mb->typefixed = old->typefixed;
mb->flowfixed = old->flowfixed;
+ mb->maxarg= old->maxarg;
/* copy the properties as well */
if (mb->props)
mb->props = cpyPropertySet(old->props);
@@ -906,7 +909,7 @@
mb->stmt[mb->stop] = NULL;
}
if (p == NULL) {
- p = GDKmalloc(sizeof(InstrRecord));
+ p = GDKmalloc(MAXARG * sizeof(short) + sizeof(InstrRecord));
p->maxarg = MAXARG;
}
p->typechk = TYPE_UNKNOWN;
@@ -952,7 +955,7 @@
copyInstruction(InstrPtr p)
{
InstrPtr new;
- new = (InstrPtr) GDKmalloc(sizeof(InstrRecord) + sizeof(short) *
(p->maxarg - MAXARG));
+ new = (InstrPtr) GDKmalloc(sizeof(InstrRecord) + p->maxarg *
sizeof(short));
oldmoveInstruction(new, p);
return new;
}
@@ -969,7 +972,7 @@
clrInstruction(InstrPtr p)
{
clrFunction(p);
- memset((char *) p, 0, sizeof(InstrRecord) + (p->maxarg - MAXARG) *
sizeof(int));
+ memset((char *) p, 0, sizeof(InstrRecord) + p->maxarg * sizeof(short));
}
void
@@ -988,7 +991,7 @@
{
int space;
- space = sizeof(InstrRecord) + sizeof(short) * (p->maxarg-MAXARG);
+ space = sizeof(InstrRecord) + p->maxarg * sizeof(short);
memcpy((char *) new, (char *) p, space);
setFunctionId(new, getFunctionId(p));
setModuleId(new, getModuleId(p));
@@ -1829,7 +1832,7 @@
if (p->argc == p->maxarg) {
InstrPtr pn;
int pc = 0,pclimit;
- int space = (p->maxarg - MAXARG) * sizeof(short) +
sizeof(InstrRecord);
+ int space = p->maxarg * sizeof(short) + sizeof(InstrRecord);
pn = GDKmalloc(space + MAXARG * sizeof(short));
memcpy((char *) pn, (char *) p, space);
pn->maxarg += MAXARG;
@@ -1852,6 +1855,10 @@
mb->stmt[pc] = pn;
break;
}
+ /* we have to keep track on the maximal arguments/block
+ because it is needed by the interpreter */
+ if( mb->maxarg < pn->maxarg)
+ mb->maxarg= pn->maxarg;
GDKfree(p);
p = pn;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins