Changeset: 5892f2a6584c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5892f2a6584c
Modified Files:
clients/mapiclient/mclient.1
monetdb5/extras/jaql/jaql.c
monetdb5/extras/jaql/jaql.h
monetdb5/extras/jaql/jaql.mal
monetdb5/extras/jaql/jaqlgencode.c
monetdb5/extras/jaql/jaqlscenario.c
monetdb5/extras/jaql/jaqltree.h
monetdb5/extras/jaql/parser/jaql.l
monetdb5/extras/jaql/parser/jaql.y
monetdb5/modules/kernel/alarm.c
tools/merovingian/client/monetdb.1
Branch: default
Log Message:
Merge with Oct2012 branch.
diffs (truncated from 629 to 300 lines):
diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1
--- a/clients/mapiclient/mclient.1
+++ b/clients/mapiclient/mclient.1
@@ -1,4 +1,4 @@
-.TH MCLIENT 1 "APRIL 2011" MonetDB "MonetDB Applications"
+.TH MCLIENT 1 "NOVEMBER 2012" MonetDB "MonetDB Applications"
.SH NAME
mclient \- the MonetDB command-line tool
.SH SYNOPSIS
@@ -17,7 +17,7 @@ mclient \- the MonetDB command-line tool
MonetDB is a database management system that is developed from a
main-memory perspective with use of a fully decomposed storage model,
automatic index management, extensibility of data types and search
-accelerators, SQL- and XML- frontends.
+accelerators, SQL- and JAQL- frontends.
.PP
.I mclient
is the command-line interface to the MonetDB server.
diff --git a/monetdb5/extras/jaql/jaql.c b/monetdb5/extras/jaql/jaql.c
--- a/monetdb5/extras/jaql/jaql.c
+++ b/monetdb5/extras/jaql/jaql.c
@@ -1949,7 +1949,9 @@ JAQLexecute(Client cntxt, MalBlkPtr mb,
jaqllex_init_extra(j, &j->scanner);
do {
+ j->timing.parse = GDKusec();
jaqlparse(j);
+ j->timing.parse = GDKusec() - j->timing.parse;
if (j->err[0] != '\0')
break;
@@ -1971,7 +1973,9 @@ JAQLexecute(Client cntxt, MalBlkPtr mb,
if (j->err[0] != '\0')
break;
+ j->timing.optimise = GDKusec();
chkProgram(cntxt->fdout, cntxt->nspace, prg->def);
+ j->timing.optimise = GDKusec() - j->timing.optimise;
if (j->explain) {
printFunction(cntxt->fdout, prg->def, 0,
LIST_MAL_STMT | LIST_MAPI);
@@ -2208,3 +2212,37 @@ JAQLbatconcat(Client cntxt, MalBlkPtr mb
*ret = b->batCacheid;
return MAL_SUCCEED;
}
+
+str
+JAQLprintTimings(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+ int *ret = (int *)getArgReference(stk, pci, 0);
+ lng *exec = (lng *)getArgReference(stk, pci, 1);
+ lng *trans = (lng *)getArgReference(stk, pci, 2);
+ jc *j = NULL;
+ str err;
+
+ (void)mb;
+ (void)stk;
+ (void)pci;
+
+ if ((err = getJAQLContext(cntxt, &j)) != MAL_SUCCEED)
+ GDKfree(err);
+
+ mnstr_printf(cntxt->fdout,
+ "# [\n"
+ "# { \"parse\": %9lld },\n"
+ "# { \"gencode\": %9lld },\n"
+ "# { \"optimise\": %9lld },\n"
+ "# { \"execute\": %9lld },\n"
+ "# { \"transport\": %9lld }\n"
+ "# ]\n",
+ j->timing.parse,
+ j->timing.gencode,
+ j->timing.optimise,
+ *exec,
+ *trans);
+
+ *ret = 0;
+ return MAL_SUCCEED;
+}
diff --git a/monetdb5/extras/jaql/jaql.h b/monetdb5/extras/jaql/jaql.h
--- a/monetdb5/extras/jaql/jaql.h
+++ b/monetdb5/extras/jaql/jaql.h
@@ -43,6 +43,7 @@ jaql_export str JAQLgetVar(Client cntxt,
jaql_export str JAQLsetVar(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
jaql_export str JAQLcast(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
jaql_export str JAQLbatconcat(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
+jaql_export str JAQLprintTimings(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
#endif
diff --git a/monetdb5/extras/jaql/jaql.mal b/monetdb5/extras/jaql/jaql.mal
--- a/monetdb5/extras/jaql/jaql.mal
+++ b/monetdb5/extras/jaql/jaql.mal
@@ -41,6 +41,10 @@ pattern batconcat(l:bat[:oid,:str], r:ba
address JAQLbatconcat
comment "Return the string concatenation of the tails of both input BATs";
+pattern printTimings(execute:lng, transport:lng):void
+address JAQLprintTimings
+comment "Print timing breakdown information to stdout stream";
+
# scenario functions and init call
command prelude()
address JAQLprelude;
diff --git a/monetdb5/extras/jaql/jaqlgencode.c
b/monetdb5/extras/jaql/jaqlgencode.c
--- a/monetdb5/extras/jaql/jaqlgencode.c
+++ b/monetdb5/extras/jaql/jaqlgencode.c
@@ -5427,6 +5427,7 @@ dumptree(jc *j, Client cntxt, MalBlkPtr
{
InstrPtr q;
int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
+ int etime = -1, ttime = -1, stime = -1;
tree *trout = NULL;
/* start with a clean sheet */
@@ -5435,6 +5436,14 @@ dumptree(jc *j, Client cntxt, MalBlkPtr
/* this function is not used recursively, so this is the first thing
* in the resulting MAL plan */
+ if (j->time) {
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, alarmRef);
+ setFunctionId(q, putName("usec", 4));
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ etime = getArg(q, 0);
+ pushInstruction(mb, q);
+ }
if (j->trace) {
newStmt(mb, profilerRef, "reset");
q = newStmt(mb, profilerRef, "setFilter");
@@ -5450,6 +5459,8 @@ dumptree(jc *j, Client cntxt, MalBlkPtr
j->p = t;
}
+ j->timing.gencode = GDKusec();
+
/* each iteration in this loop is a pipe (a JSON document)
* represented by the j1..7 vars */
while (t != NULL) {
@@ -5510,6 +5521,14 @@ dumptree(jc *j, Client cntxt, MalBlkPtr
pushInstruction(mb, q);
break;
case j_output:
+ if (j->time) {
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, alarmRef);
+ setFunctionId(q, putName("usec", 4));
+ q = pushReturn(mb, q,
newTmpVariable(mb, TYPE_any));
+ ttime = getArg(q, 0);
+ pushInstruction(mb, q);
+ }
q = newInstruction(mb, ASSIGNsymbol);
setModuleId(q, ioRef);
setFunctionId(q, putName("stdout", 6));
@@ -7433,6 +7452,8 @@ dumptree(jc *j, Client cntxt, MalBlkPtr
t = t->next;
}
+ j->timing.gencode = GDKusec() - j->timing.gencode;
+
if (j->trace) {
newStmt(mb, profilerRef, "stop");
/* call gettrace function, and print it */
@@ -7445,6 +7466,55 @@ dumptree(jc *j, Client cntxt, MalBlkPtr
j->trace = 1;
freetree(t);
}
+ if (j->time) {
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, alarmRef);
+ setFunctionId(q, putName("usec", 4));
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ stime = getArg(q, 0);
+ pushInstruction(mb, q);
+ if (ttime >= 0) {
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, calcRef);
+ setFunctionId(q, putName("-", 1));
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ q = pushArgument(mb, q, stime);
+ q = pushArgument(mb, q, ttime);
+ a = getArg(q, 0);
+ pushInstruction(mb, q);
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, calcRef);
+ setFunctionId(q, putName("-", 1));
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ q = pushArgument(mb, q, ttime);
+ q = pushArgument(mb, q, etime);
+ b = getArg(q, 0);
+ pushInstruction(mb, q);
+ etime = b;
+ ttime = a;
+ } else {
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, calcRef);
+ setFunctionId(q, putName("-", 1));
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ q = pushArgument(mb, q, stime);
+ q = pushArgument(mb, q, etime);
+ etime = getArg(q, 0);
+ pushInstruction(mb, q);
+ q = newInstruction(mb, ASSIGNsymbol);
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ q = pushLng(mb, q, 0L);
+ ttime = getArg(q, 0);
+ pushInstruction(mb, q);
+ }
+ q = newInstruction(mb, ASSIGNsymbol);
+ setModuleId(q, putName("jaql", 4));
+ setFunctionId(q, putName("printTimings", 12));
+ q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+ q = pushArgument(mb, q, etime);
+ q = pushArgument(mb, q, ttime);
+ pushInstruction(mb, q);
+ }
return -1;
}
diff --git a/monetdb5/extras/jaql/jaqlscenario.c
b/monetdb5/extras/jaql/jaqlscenario.c
--- a/monetdb5/extras/jaql/jaqlscenario.c
+++ b/monetdb5/extras/jaql/jaqlscenario.c
@@ -194,8 +194,11 @@ JAQLparser(Client c)
j->scanstreameof = 0;
j->pos = 0;
j->p = NULL;
+ j->timing.parse = j->timing.optimise = j->timing.gencode = 0L;
+ j->timing.parse = GDKusec();
jaqlparse(j);
+ j->timing.parse = GDKusec() - j->timing.parse;
/* stop if it seems nothing is going to come any more */
if (j->scanstreameof == 1) {
@@ -235,7 +238,9 @@ JAQLparser(Client c)
throw(PARSE, "JAQLparse", "%s", j->err);
}
+ j->timing.optimise = GDKusec();
chkTypes(out, c->nspace, prg->def, FALSE);
+ j->timing.optimise = GDKusec() - j->timing.optimise;
if (prg->def->errors) {
/* this is bad already, so let's try to make it
debuggable */
mnstr_printf(out, "!jaqlgencode: generated program
contains errors\n");
diff --git a/monetdb5/extras/jaql/jaqltree.h b/monetdb5/extras/jaql/jaqltree.h
--- a/monetdb5/extras/jaql/jaqltree.h
+++ b/monetdb5/extras/jaql/jaqltree.h
@@ -50,12 +50,18 @@ typedef struct _jc {
trace:3,
plan:4,
planf:5,
- mapimode:6,
- scanstreameof:7;
+ time:6,
+ mapimode:7,
+ scanstreameof:8;
jvar *vars;
int j1, j2, j3, j4, j5, j6, j7, startoid;
char ro1:1, ro2:2, ro3:3, ro4:4, ro5:5, ro6:6, ro7:7;
int vtop;
+ struct {
+ long long int parse;
+ long long int gencode;
+ long long int optimise;
+ } timing;
} jc;
/* the order here does matter for filter */
diff --git a/monetdb5/extras/jaql/parser/jaql.l
b/monetdb5/extras/jaql/parser/jaql.l
--- a/monetdb5/extras/jaql/parser/jaql.l
+++ b/monetdb5/extras/jaql/parser/jaql.l
@@ -168,6 +168,7 @@ plan return PLAN;
planf return PLANF;
debug return DEBUG;
trace return TRACE;
+time return TIME;
/* language constructs */
"->" return ARROW;
diff --git a/monetdb5/extras/jaql/parser/jaql.y
b/monetdb5/extras/jaql/parser/jaql.y
--- a/monetdb5/extras/jaql/parser/jaql.y
+++ b/monetdb5/extras/jaql/parser/jaql.y
@@ -58,7 +58,7 @@ jaql_import void GDKfree(const char *);
%start stmt
%token EACH FILTER TRANSFORM EXPAND GROUP INTO BY AS JOIN WHERE IN
-%token SORT TOP DESC ASC EXPLAIN PLAN PLANF DEBUG TRACE UNROLL PRESERVE
+%token SORT TOP DESC ASC EXPLAIN PLAN PLANF DEBUG TRACE TIME UNROLL PRESERVE
%token ARROW ASSIGN EQUALS NEQUAL TRUE FALSE NIL
%token GREATER GEQUAL LESS LEQUAL NOT AND OR
@@ -159,6 +159,12 @@ stmt: jaql ';'
j->trace = 1;
YYACCEPT;
}
+ | TIME jaql ';'
+ {
+ j->p = $2;
+ j->time = 1;
+ YYACCEPT;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list