Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11791
Modified Files:
Tag: xquery-decomposition
pathfinder.mx rt_projection.mx xrpc_client.mx xrpc_server.mx
Log Message:
major change: rewritten many functions in xrpc_server.mx to speedy up
finding parameter values in a request message, needs to be tested.
minor changes in other files.
Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.41.2.11
retrieving revision 1.41.2.12
diff -u -d -r1.41.2.11 -r1.41.2.12
--- xrpc_client.mx 10 Mar 2008 18:32:28 -0000 1.41.2.11
+++ xrpc_client.mx 11 Mar 2008 03:59:42 -0000 1.41.2.12
@@ -452,7 +452,7 @@
time_xrpcClntSeria := usec() - time_xrpcClntSeria;
if (options.search("timing") >= 0) {
- printf("XRPC_Client_Serialisation (get_dst_params): %10.2f
msec\n",
+ printf("XRPC_Client_Serialisation (get_dst_params): %10.2f msec\n",
(time_xrpcClntSeria/1000.0));
}
@@ -832,8 +832,7 @@
char *host,
int port,
buffer *b,
- int updCall,
- lng *time_xrpcClntDeSeria)
+ int updCall)
{
char *strptr = NULL, respStatus[1024];
int ret;
@@ -909,8 +908,6 @@
return NULL;
}
- /* Start timing Client DeSerialisation */
- *time_xrpcClntDeSeria = GDKusec();
if (!(shredBAT = BATnew(TYPE_str, TYPE_bat, 32))){
GDKerror("response2bat: failed to malloc shredBAT\n");
stream_close(in); stream_destroy(in);
@@ -928,7 +925,6 @@
stream_close(in); stream_destroy(in);
if(b->pos == 0){ /* no error message => operation succeeded */
- *time_xrpcClntDeSeria = GDKusec() - *time_xrpcClntDeSeria;
return shredBAT;
} else {
handle_error_msg(b->buf);
@@ -944,14 +940,13 @@
return NULL;
}
- /* Stop timing Client DeSerialisation */
- *time_xrpcClntDeSeria = GDKusec() - *time_xrpcClntDeSeria;
stream_close(in); stream_destroy(in);
return shredBAT;
}
static INLINE projection_mapping*
serialize_fragments(
+ str options,
buffer *b,
stream *bs,
BAT *ws,
@@ -1002,8 +997,8 @@
rkinds = BATdescriptor(*(bat*)BUNtail(rkindsi, rkind_base + i));
str2buf(b, "<xrpc:fragments>");
- contIDnew = runtime_doc_projection2stream(NULL,
- printmode, bs, ws,
+ contIDnew = runtime_doc_projection2stream(options,
+ printmode, bs, FALSE, ws,
uitems, ukinds, ritems, rkinds,
int_values, dbl_values, dec_values, str_values);
str2buf(b, "</xrpc:fragments>");
@@ -1083,8 +1078,7 @@
BATiter strValsi, qn_prefixi, qn_urii, qn_loci, upathi, rpathi;
BUN upath_base, rpath_base;
- lng time_xrpcClntSeria = 0, time_xrpcClntDeSeria = 0;
- lng time_xrpcClnt2Serv = 0;
+ lng time_xrpcClntSeria = 0, time_xrpcClnt2Serv = 0;
size_t bytes_sent = 0;
errCheck(iterc, argc, ws, used_item, used_kind,
@@ -1161,9 +1155,9 @@
updCall?"true":"false");
assert((b->pos > 0) && (b->pos < b->len));
- if(!(pm = serialize_fragments(b, bs, ws, used_item, used_kind,
- returned_item, returned_kind, int_values, dbl_values,
- dec_values, str_values))) {
+ if(!(pm = serialize_fragments(options, b, bs, ws,
+ used_item, used_kind, returned_item, returned_kind,
+ int_values, dbl_values, dec_values, str_values))) {
GDKerror("CMDhttp_post: failed to serialize fragments.\n");
clean_up(sock, out, bs, b, argcnt, iterc, pm);
return GDK_FAIL;
@@ -1450,24 +1444,22 @@
/* Stop timing Network Send Client2Server */
time_xrpcClnt2Serv= GDKusec() - time_xrpcClnt2Serv;
- shredBAT = response2bat(sock, dst, port, b, *updCall,
- &time_xrpcClntDeSeria);
+ lng time_remoteExec = GDKusec();
+ shredBAT = response2bat(sock, dst, port, b, *updCall);
clean_up(-1, out, bs, b, argcnt, iterc, pm);
-
- if(!shredBAT) {
- return GDK_FAIL;
- }
+ if(!shredBAT) return GDK_FAIL;
+ time_remoteExec = GDKusec() - time_remoteExec;
if (options && strstr(options, "timing")) {
stream_printf(GDKout,
- "XRPC_Client_Serialisation (create_req_msg): %10.2f msec\n"
- "XRPC_Network_Client_2_Server: %10.2f msec\n"
- "XRPC_Data_Sent: " SZFMT " bytes\n\n"
- "XRPC_Client_DeSerialisation (response2bat): %10.2f msec\n",
+ "XRPC_Client_Serialisation (create_req_msg): %10.2f msec\n"
+ "XRPC_Network_Client_2_Server: %10.2f msec\n"
+ "XRPC_Data_Sent: " SZFMT "
bytes\n\n"
+ "XRPC_Remote_Execution_Total (response2bat): %10.2f msec\n",
(time_xrpcClntSeria/1000.0),
(time_xrpcClnt2Serv/1000.0),
bytes_sent,
- (time_xrpcClntDeSeria/1000.0));
+ (time_remoteExec/1000.0));
}
*res = shredBAT;
Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.391.2.9
retrieving revision 1.391.2.10
diff -u -d -r1.391.2.9 -r1.391.2.10
--- pathfinder.mx 10 Mar 2008 18:32:25 -0000 1.391.2.9
+++ pathfinder.mx 11 Mar 2008 03:59:41 -0000 1.391.2.10
@@ -6090,6 +6090,7 @@
(*ctx->moduleNS) = buf;
buf = GDKstrdup(method);
(*ctx->method) = buf;
+ (*ctx->time_print) = 0; /* It seems that ctx->time_print is not cleaned up
after an XRPC call */
err = xquery_change_genType(ctx, mode);
if (err) return err;
@@ -6116,6 +6117,8 @@
}
time_xrpcServApp = GDKusec() - time_xrpcServApp;
+#if 0
+ /* this timing seems not accurate/correct */
if (flags&1){
/* print timing ourselves */
fprintf(stdout, "\n"
@@ -6124,6 +6127,7 @@
(*ctx->time_shred + *ctx->time_compile +
*ctx->time_exec)/1000.0,
*ctx->time_print/1000.0);
}
+#endif
if (s) {
stream_close(ctx->fderr);
Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.58.2.8
retrieving revision 1.58.2.9
diff -u -d -r1.58.2.8 -r1.58.2.9
--- xrpc_server.mx 10 Mar 2008 18:32:28 -0000 1.58.2.8
+++ xrpc_server.mx 11 Mar 2008 03:59:42 -0000 1.58.2.9
@@ -149,6 +149,13 @@
#define MAX_NR_PARAMS 1024
+#define REQ_MODULE 0
+#define REQ_LOCATION 1
+#define REQ_METHOD 2
+#define REQ_ARITY 3
+#define REQ_ITER_COUNT 4
+#define NR_REQ_ATTRS 5
+
#endif /* XRPC_SERVER_H */
[...1012 lines suppressed...]
+ if(strcmp(reqattrs[REQ_MODULE], MXQ_ADMIN) != 0){
send_err(mc->c->fdout, TRUE, ERR404, "env:Sender",
"Invalid namespace of admin module");
- clean_up(argcnt, argtpe, argval, iterc, nr_args);
+ clean_up(reqattrs, argcnt, argtpe, argval, iterc, nr_args, NULL, NULL,
NULL);
BBPreclaim(shredBAT);
return GDK_FAIL;
}
- ret = execQuery(mc, serializeMode, module, location, method, argc,
- iterc, argcnt, argtpe, argval, isSimpleParam?NULL:shredBAT);
+ ret = execQuery(mc, serializeMode,
+ reqattrs[REQ_MODULE], reqattrs[REQ_LOCATION], reqattrs[REQ_METHOD],
+ argc, iterc, argcnt, argtpe, argval, isSimpleParam?NULL:shredBAT);
- clean_up(argcnt, argtpe, argval, iterc, nr_args);
+ clean_up(reqattrs, argcnt, argtpe, argval, iterc, nr_args, NULL, NULL,
NULL);
BBPreclaim(shredBAT);
return ret;
}
Index: rt_projection.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/Attic/rt_projection.mx,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -d -r1.1.2.14 -r1.1.2.15
--- rt_projection.mx 10 Mar 2008 18:32:27 -0000 1.1.2.14
+++ rt_projection.mx 11 Mar 2008 03:59:41 -0000 1.1.2.15
@@ -38,13 +38,6 @@
bte *knd;
} pcontext;
-/* For XRPC client/server to access these functions directly */
-BAT**
-getProjectedNodes(
- BAT *ws,
- int contID, /* container ID containing the used/returned nodes */
- pcontext *ctx); /* list of used|returned nodes, sorted on PRE */
-
BAT *
getBatFromContainer(BAT *ws, int batID, int contID);
@@ -52,6 +45,7 @@
str options,
str printmode,
stream *out,
+ bit checkContID,
BAT *ws,
BAT *used_item,
BAT *used_kind,
@@ -370,7 +364,7 @@
* Returns: the container ID, or -1 on errors
*/
static INLINE int
-getContID(BAT *used_kind, BAT *returned_kind)
+getContID(bit check, BAT *used_kind, BAT *returned_kind)
{
unsigned int contID = 0, nused = 0, nreturned = 0;
unsigned int *ukinds = NULL, *rkinds = NULL;
@@ -381,6 +375,9 @@
ukinds = (unsigned int*) Tloc(used_kind, BUNfirst(used_kind));
rkinds = (unsigned int*) Tloc(returned_kind, BUNfirst(returned_kind));
contID = nused > 0 ? XTRACT_CONT(ukinds[0]) : XTRACT_CONT(rkinds[0]);
+
+ if(!check) return contID;
+
for(i = 0; i< nused; i++){
if(XTRACT_KIND(ukinds[i]) < NODE){
GDKerror("getContID: used_item["OIDFMT"] is of kind %d, "
@@ -648,8 +645,9 @@
return ctx;
}
-BAT**
+static BAT**
getProjectedNodes(
+ bit timing,
BAT *ws,
int contID, /* container ID containing the used/returned nodes */
pcontext *ctx) /* list of used|returned nodes, sorted on PRE */
@@ -666,9 +664,7 @@
BAT **res = NULL; /* size | level | prop | kind | nid */
BATiter bi;
- ERRORcheck(!ws, "getProjectedNodes: 'ws' may no be NULL.\n");
- ERRORcheck(contID < 0, "getProjectedNodes: 'contID' must be negative.\n");
- ERRORcheck(!ctx, "getProjectedNodes: 'ctx' may no be NULL.\n");
+ assert(ws && ctx && (contID >= 0));
stk.pre = NULL;
stk.off = NULL;
@@ -714,9 +710,14 @@
/* we perform a forwards scan with skipping, that carries out an *optimal*
* depth-first DOM tree traversal (where we visit nodes only if needed)
*/
+
+ lng time_findNodes = GDKusec();
+ lng time_copy2Output = 0;
while(cur < ctx->size) { /* while still context nodes active */
if (ctx->pre[cur] == pre) { /* found a context node */
+ lng time_copy2Output1Node = GDKusec();
+
inc = ctx->knd[cur] == USED ? 1 : pre_size[ctx->pre[cur]] + 1;
/* calculate the number of new nodes on stack, for a correct
newsize of an old node on stack */
k = 0;
@@ -746,16 +747,9 @@
GDKerror("getProjectedNodes: append to res[3]
failed\n");
goto getpnodes_failed;
}
- if(pre_nid){
- if(!BUNappend(res[4], (ptr)&pre_nid[stk.pre[i]],
FALSE)){
- GDKerror("getProjectedNodes: append to res[4]
failed\n");
- goto getpnodes_failed;
- }
- } else {
- if(!BUNappend(res[4], (ptr)&stk.pre[i], FALSE)){
- GDKerror("getProjectedNodes: append to res[4]
failed\n");
- goto getpnodes_failed;
- }
+ if(!BUNappend(res[4],
pre_nid?(ptr)&pre_nid[stk.pre[i]]:(ptr)&stk.pre[i], FALSE)){
+ GDKerror("getProjectedNodes: append to res[4]
failed\n");
+ goto getpnodes_failed;
}
} else { /* already in output, update 'size' */
/* newsize = current-size + nr-new-nodes-on-stack +
size-of-context-node */
@@ -783,16 +777,9 @@
GDKerror("getProjectedNodes: append to res[3] failed\n");
goto getpnodes_failed;
}
- if(pre_nid) {
- if(!BUNappend(res[4], (ptr)&pre_nid[pre], FALSE)){
- GDKerror("getProjectedNodes: append to res[4]
failed\n");
- goto getpnodes_failed;
- }
- } else {
- if(!BUNappend(res[4], (ptr)&pre, FALSE)){
- GDKerror("getProjectedNodes: append to res[4]
failed\n");
- goto getpnodes_failed;
- }
+ if(!BUNappend(res[4], pre_nid?(ptr)&pre_nid[pre]:(ptr)&pre,
FALSE)){
+ GDKerror("getProjectedNodes: append to res[4] failed\n");
+ goto getpnodes_failed;
}
if ( ((cur + 1) < ctx->size) &&
(ctx->pre[cur + 1] < (pre + pre_size[pre] + 1)) ){
@@ -823,20 +810,15 @@
GDKerror("getProjectedNodes: append to res[3]
failed\n");
goto getpnodes_failed;
}
- if(pre_nid) {
- if(!BUNappend(res[4], (ptr)&pre_nid[i], FALSE)){
- GDKerror("getProjectedNodes: append to res[4]
failed\n");
- goto getpnodes_failed;
- }
- } else {
- if(!BUNappend(res[4], (ptr)&i, FALSE)){
- GDKerror("getProjectedNodes: append to res[4]
failed\n");
- goto getpnodes_failed;
- }
+ if(!BUNappend(res[4], pre_nid?(ptr)&pre_nid[i]:(ptr)&i,
FALSE)){
+ GDKerror("getProjectedNodes: append to res[4]
failed\n");
+ goto getpnodes_failed;
}
}
}
cur++;
+
+ time_copy2Output += GDKusec() - time_copy2Output1Node;
} else if (ctx->pre[cur] <= pre + pre_size[pre]) {
/* next context node is in the descendants: go find it */
if(push(&stk, pre) == GDK_FAIL) break; /* should not happen */
@@ -866,6 +848,14 @@
}
}
+ time_findNodes = GDKusec() - time_findNodes;
+ if(timing){
+ stream_printf(GDKout, " time_findNodes: %10.2f msec\n",
+ ((time_findNodes - time_copy2Output)/1000.0));
+ stream_printf(GDKout, " time_copy2Output: %10.2f msec\n",
+ (time_copy2Output/1000.0));
+ }
+
if(cur < ctx->size)
goto getpnodes_failed;
@@ -906,6 +896,7 @@
str options,
str printmode,
stream *out,
+ bit checkContID,
BAT *ws,
BAT *used_item,
BAT *used_kind,
@@ -922,8 +913,7 @@
unsigned char *kinds = NULL;
pcontext *ctx = NULL;
oid i = oid_nil;
-
- lng time_projCalc = GDKusec(); /* start timer*/
+ bit timing = FALSE;
if(!out || !ws || !used_item || !used_kind || !returned_item ||
!returned_kind ||
!int_values || !dbl_values || !dec_values || !str_values) {
@@ -944,7 +934,11 @@
return -1;
}
- if( (contID = getContID(used_kind, returned_kind)) < 0 )
+ if(options && strstr(options, "timing")) timing = TRUE;
+
+ lng time_projCalc = GDKusec(); /* start timer*/
+
+ if( (contID = getContID(checkContID, used_kind, returned_kind)) < 0 )
return -1;
lng time_getProjectionCtx = GDKusec(); /* start timer */
@@ -956,7 +950,7 @@
lng time_calcProjectedNodes = GDKusec(); /* start timer */
/* calculate the projected nodes */
- if(!(res_bats = getProjectedNodes(ws, contID, ctx))) {
+ if(!(res_bats = getProjectedNodes(timing, ws, contID, ctx))) {
GDKfree(ctx->pre); GDKfree(ctx->knd); GDKfree(ctx);
return -1;
}
@@ -988,15 +982,15 @@
status = contIDnew;
time_projCalc = GDKusec() - time_projCalc; /* stop timer */
- if(options && strstr(options, "timing")) {
- stream_printf(GDKout, "CalculateProjection: %10.2f msec\n",
- (time_projCalc/1000.0));
- stream_printf(GDKout, "getProjectionCtx: %10.2f msec\n",
- (time_getProjectionCtx/1000.0));
- stream_printf(GDKout, "calProjectedNodes: %10.2f msec\n",
+ if(timing) {
+ stream_printf(GDKout, " calcProjectedNodes: %10.2f msec\n",
(time_calcProjectedNodes/1000.0));
- stream_printf(GDKout, "cp2Container: %10.2f msec\n",
+ stream_printf(GDKout, " getProjectionCtx: %10.2f msec\n",
+ (time_getProjectionCtx/1000.0));
+ stream_printf(GDKout, " cp2Container: %10.2f msec\n",
(time_cp2Container/1000.0));
+ stream_printf(GDKout, "Total project time: %10.2f msec\n",
+ (time_projCalc/1000.0));
}
if(out) { /* serialize projected nodes to file */
@@ -1070,8 +1064,8 @@
BBPreclaim(print_kind);
time_projSeria = GDKusec() - time_projSeria; /* stop timer */
- if(options && strstr(options, "timing")) {
- stream_printf(GDKout, "ProjSeria: %10.2f msec\n",
+ if(timing) {
+ stream_printf(GDKout, "ProjSeria: %10.2f msec\n",
(time_projSeria/1000.0));
}
}
@@ -1114,7 +1108,7 @@
} else if (GDKcreatedir(file)) {
if((fp = fopen(file, "wb"))) {
if((out = file_wastream(fp, file))){
- ret = runtime_doc_projection2stream(options, "xml-noroot",
out, ws,
+ ret = runtime_doc_projection2stream(options, "xml-noroot",
out, TRUE, ws,
used_item, used_kind, returned_item, returned_kind,
int_values, dbl_values, dec_values, str_values);
stream_destroy(out);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins