Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17130

Modified Files:
      Tag: xquery-decomposition
        pathfinder.mx rt_projection.mx xrpc_client.mx xrpc_server.mx 
Log Message:
- get this thing working
- add printing time



Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.41.2.10
retrieving revision 1.41.2.11
diff -u -d -r1.41.2.10 -r1.41.2.11
--- xrpc_client.mx      10 Mar 2008 11:03:04 -0000      1.41.2.10
+++ xrpc_client.mx      10 Mar 2008 18:32:28 -0000      1.41.2.11
@@ -97,17 +97,25 @@
     # split used_<item|kind> into multiple BATs according to their container 
IDs
     var conts := get_container([int](used_kind)); # [oid,int]: container IDs 
in tail
     var nconts := count(tunique(conts));
-    # contIDs are grouped in tail BATs per container, contIDs in head
-    var rs := rangesplit(conts, 
nconts).reverse().mirror().[fetch](0).reverse();
-    var uitems := rs.[hmark](oid(nil)).[leftfetchjoin](const 
used_item).[tmark](const [EMAIL PROTECTED]);
-    var ukinds := rs.[hmark](oid(nil)).[leftfetchjoin](const 
used_kind).[tmark](const [EMAIL PROTECTED]);
+    var uitems := bat(oid,bat,0);
+    var ukinds := bat(oid,bat,0);
+    if(nconts > 0) {
+        # contIDs are grouped in tail BATs per container, contIDs in head
+        var rs := rangesplit(conts, 
nconts).reverse().mirror().[fetch](0).reverse();
+        uitems := rs.[hmark](oid(nil)).[leftfetchjoin](const 
used_item).[tmark](const [EMAIL PROTECTED]);
+        ukinds := rs.[hmark](oid(nil)).[leftfetchjoin](const 
used_kind).[tmark](const [EMAIL PROTECTED]);
+    }
 
     # split returned_<item|kind> into multiple BATs according to their 
container IDs
     conts := get_container([int](returned_kind)); # [oid,int]: container IDs 
in tail
     nconts := count(tunique(conts));
-    rs := rangesplit(conts, nconts).reverse().mirror().[fetch](0).reverse(); # 
get contID in head
-    var ritems := rs.[hmark](oid(nil)).[leftfetchjoin](const 
returned_item).[tmark](const [EMAIL PROTECTED]);
-    var rkinds := rs.[hmark](oid(nil)).[leftfetchjoin](const 
returned_kind).[tmark](const [EMAIL PROTECTED]);
+    var ritems := bat(oid,bat,0);
+    var rkinds := bat(oid,bat,0);
+    if(nconts > 0){
+        var rs := rangesplit(conts, 
nconts).reverse().mirror().[fetch](0).reverse(); # get contID in head
+        ritems := rs.[hmark](oid(nil)).[leftfetchjoin](const 
returned_item).[tmark](const [EMAIL PROTECTED]);
+        rkinds := rs.[hmark](oid(nil)).[leftfetchjoin](const 
returned_kind).[tmark](const [EMAIL PROTECTED]);
+    }
 
     # align uitems|kinds and ritems|kinds,
     # fill missing container with emtpybat
@@ -134,8 +142,8 @@
 
     time_xrpcClntDeSeria := usec() - time_xrpcClntDeSeria;
     if (options.search("timing") >= 0) {
-        printf("XRPC_Client_DeSerialisation (ws_opencoll):    %lld microsec\n",
-                time_xrpcClntDeSeria);
+        printf("XRPC_Client_DeSerialisation (ws_opencoll):    %10.2f msec\n",
+                (time_xrpcClntDeSeria/1000.0));
     }
 
     return ret;
@@ -444,8 +452,8 @@
 
         time_xrpcClntSeria := usec() - time_xrpcClntSeria;
         if (options.search("timing") >= 0) {
-            printf("XRPC_Client_Serialisation (get_dst_params):   %lld 
microsec\n",
-                    time_xrpcClntSeria);
+            printf("XRPC_Client_Serialisation (get_dst_params):   %10.2f 
msec\n",
+                    (time_xrpcClntSeria/1000.0));
         }
 
         var local_name := "rpc_res_00" + str(int($h)+off);
@@ -472,8 +480,8 @@
             }
             time_xrpcClntDeSeria := usec() - time_xrpcClntDeSeria;
             if (options.search("timing") >= 0) {
-                printf("XRPC_Client_DeSerialisation (insert_rpc_oid): %lld 
microsec\n",
-                        time_xrpcClntDeSeria);
+                printf("XRPC_Client_DeSerialisation (insert_rpc_oid): %10.2f 
msec\n",
+                        (time_xrpcClntDeSeria/1000.0));
             }
         } else {
             # We do not want to discard results from other destinations
@@ -529,8 +537,8 @@
 
     time_xrpcClntDeSeria := usec() - time_xrpcClntDeSeria;
     if (options.search("timing") >= 0) {
-        printf("XRPC_Client_DeSerialisation (get_rpc_res):    %lld microsec\n",
-                time_xrpcClntDeSeria);
+        printf("XRPC_Client_DeSerialisation (get_rpc_res):    %10.2f msec\n",
+                (time_xrpcClntDeSeria/1000.0));
     }
 
     return res_bats;
@@ -965,7 +973,6 @@
     int contIDnew = int_nil;
     char printmode[64] = "xml-noheader-root-xrpc:fragment\0";
 
-    assert(BATcount(used_item) > 0 && BATcount(returned_item)); /* may not be 
empty */
     assert(BATcount(used_item) == BATcount(returned_item)); /* must be aligned 
*/
 
     /* Serialize node-typed parameter's in xrpc:fragments */
@@ -975,6 +982,7 @@
         return NULL;
     }
     pm[nconts].contIDold = pm[nconts].contIDnew = oid_nil;
+    if(nconts == 0) return pm; /* nothing to do */
 
     uitemsi = bat_iterator(used_item);
     ukindsi = bat_iterator(used_kind);
@@ -1452,14 +1460,14 @@
 
     if (options && strstr(options, "timing")) {
         stream_printf(GDKout,
-                "XRPC_Client_Serialisation (create_req_msg):   " LLFMT " 
microsec\n"
-                "XRPC_Network_Client_2_Server:  " LLFMT " microsec\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_Client_DeSerialisation (response2bat):   " LLFMT " 
microsec\n",
-                time_xrpcClntSeria,
-                time_xrpcClnt2Serv,
+                "XRPC_Client_DeSerialisation (response2bat):   %10.2f msec\n",
+                (time_xrpcClntSeria/1000.0),
+                (time_xrpcClnt2Serv/1000.0),
                 bytes_sent,
-                time_xrpcClntDeSeria);
+                (time_xrpcClntDeSeria/1000.0));
     }
 
     *res = shredBAT;

Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.391.2.8
retrieving revision 1.391.2.9
diff -u -d -r1.391.2.8 -r1.391.2.9
--- pathfinder.mx       6 Mar 2008 15:31:37 -0000       1.391.2.8
+++ pathfinder.mx       10 Mar 2008 18:32:25 -0000      1.391.2.9
@@ -6119,10 +6119,10 @@
     if (flags&1){
         /* print timing ourselves */
         fprintf(stdout, "\n"
-               "XRPC_Server_Application:       " LLFMT " microsec\n"
-               "XRPC_Network_Server_2_Client:  " LLFMT " microsec\n",
-               (*ctx->time_shred + *ctx->time_compile + *ctx->time_exec),
-               *ctx->time_print);
+               "XRPC_Server_Application:      %10.2f msec\n"
+               "XRPC_Network_Server_2_Client: %10.2f msec\n",
+               (*ctx->time_shred + *ctx->time_compile + 
*ctx->time_exec)/1000.0,
+               *ctx->time_print/1000.0);
     }
 
     if (s) {

Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.58.2.7
retrieving revision 1.58.2.8
diff -u -d -r1.58.2.7 -r1.58.2.8
--- xrpc_server.mx      10 Mar 2008 11:03:09 -0000      1.58.2.7
+++ xrpc_server.mx      10 Mar 2008 18:32:28 -0000      1.58.2.8
@@ -1418,8 +1418,8 @@
 
     if (timing) {
         fprintf(stdout,
-                "XRPC_Server_DeSerialisation:   " LLFMT " microsec\n",
-                time_xrpcServDeSeria);
+                "XRPC_Server_DeSerialisation:   %10.2f msec\n",
+                (time_xrpcServDeSeria/1000.0));
     }
 
     clean_up(argcnt, argtpe, argval, iterc, nr_args);
@@ -1576,8 +1576,8 @@
 
     if (timing && ret != GDK_FAIL) {
         fprintf(stdout,
-                "XRPC_Server_DeSerialisation:   %lld microsec\n",
-                time_xrpcServDeSeria);
+                "XRPC_Server_DeSerialisation:   %10.2f msec\n",
+                (time_xrpcServDeSeria/1000.0));
     }
 
     GDKfree(argcnt[0]);

Index: rt_projection.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/Attic/rt_projection.mx,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -d -r1.1.2.13 -r1.1.2.14
--- rt_projection.mx    10 Mar 2008 01:55:56 -0000      1.1.2.13
+++ rt_projection.mx    10 Mar 2008 18:32:27 -0000      1.1.2.14
@@ -257,7 +257,8 @@
             "cp2Container: contIDnew MUST be larger than contIDfrom\n");
 
     wsbi = bat_iterator(ws);
-    for(off = MAP_PID; off <= ATTR_OWN_SHARED; off++){
+    //for(off = MAP_PID; off <= ATTR_OWN_SHARED; off++){
+    for(off = MAP_PID; off <= _ATTR_PROP; off++){
         BUNfndVOID(wsbun, wsbi, (ptr)&off);
         if(wsbun == BUN_NONE) {
             GDKerror("cp2Container: NOT FOUND WS["OIDFMT"]\n", off);
@@ -288,23 +289,29 @@
                 batid = BBPcacheid(pre_nid);
                 break;
             default: /* copy other ws BATs */
-                BUNfndVOID(bun, bi, (ptr)&contIDfrom);
-                if(bun == BUN_NONE) {
-                    GDKerror("cp2Container: NOT FOUND 
WS["OIDFMT"]["OIDFMT"]\n",
-                            off, contIDfrom);
-                    BBPunfix(BBPcacheid(wsbat));
-                    rmContainer(ws, (off -1), contIDnew);
-                    return GDK_FAIL;
+                if(BATcount(wsbat) >0) {
+                    BUNfndVOID(bun, bi, (ptr)&contIDfrom);
+                    if(bun == BUN_NONE) {
+                        GDKerror("cp2Container: NOT FOUND 
WS["OIDFMT"]["OIDFMT"]\n",
+                                off, contIDfrom);
+                        BBPunfix(BBPcacheid(wsbat));
+                        rmContainer(ws, (off -1), contIDnew);
+                        return GDK_FAIL;
+                    }
+                    batid = *(bat*)BUNtail(bi, bun);
+                } else {
+                    batid = int_nil;
                 }
-                batid = *(bat*)BUNtail(bi, bun);
                 break;
         }
-        if(!BUNappend(wsbat, &batid, FALSE)){
-            GDKerror("cp2Container: BUNappend(ws["OIDFMT"], %d) failed\n",
-                    off, batid);
-            BBPunfix(BBPcacheid(wsbat));
-            rmContainer(ws, (off -1), contIDnew);
-            return GDK_FAIL;
+        if(batid != int_nil) {
+            if(!BUNappend(wsbat, &batid, FALSE)){
+                GDKerror("cp2Container: BUNappend(ws["OIDFMT"], %d) failed\n",
+                        off, batid);
+                BBPunfix(BBPcacheid(wsbat));
+                rmContainer(ws, (off -1), contIDnew);
+                return GDK_FAIL;
+            }
         }
         BBPunfix(BBPcacheid(wsbat));
     }
@@ -916,7 +923,7 @@
     pcontext *ctx = NULL;
     oid i = oid_nil;
 
-    (void) options;
+    lng time_projCalc = GDKusec(); /* start timer*/
 
     if(!out || !ws || !used_item || !used_kind || !returned_item || 
!returned_kind ||
        !int_values || !dbl_values || !dec_values || !str_values) {
@@ -940,11 +947,14 @@
     if( (contID = getContID(used_kind, returned_kind)) < 0 )
         return -1;
     
+    lng time_getProjectionCtx = GDKusec(); /* start timer */
     if(!(ctx = getProjectionCtx(contID, ws, used_item, used_kind, 
returned_item, returned_kind))) {
         GDKerror("runtime_doc_projection2stream: failed to create projection 
context\n");
         return -1;
     }
+    time_getProjectionCtx = GDKusec() - time_getProjectionCtx; /* stop timer */
 
+    lng time_calcProjectedNodes = GDKusec(); /* start timer */
     /* calculate the projected nodes */
     if(!(res_bats = getProjectedNodes(ws, contID, ctx))) {
         GDKfree(ctx->pre); GDKfree(ctx->knd); GDKfree(ctx);
@@ -956,14 +966,15 @@
         GDKfree(ctx->pre); GDKfree(ctx->knd); GDKfree(ctx);
         return -1;
     }
+    time_calcProjectedNodes = GDKusec() - time_calcProjectedNodes; /* stop 
timer */
 
+    lng time_cp2Container = GDKusec(); /* start timer */
     if( (contIDnew = getNewContainerID(ws)) < 0) {
         GDKerror("runtime_doc_projection2stream: getNewContainerID failed\n");
         for(i = 0; i < 5; i++) BBPreclaim(res_bats[i]);
         GDKfree(ctx->pre); GDKfree(ctx->knd); GDKfree(ctx);
         return -1;
     }
-
     if(cp2Container(ws, contID, contIDnew, res_bats[PPRE_SIZE],
                 res_bats[PPRE_LEVEL], res_bats[PPRE_PROP],
                 res_bats[PPRE_KIND], res_bats[PPRE_NID]) == GDK_FAIL) {
@@ -972,10 +983,25 @@
         GDKfree(ctx->pre); GDKfree(ctx->knd); GDKfree(ctx);
         return -1;
     }
+    time_cp2Container = GDKusec() - time_cp2Container; /* stop timer */
 
     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",
+                (time_calcProjectedNodes/1000.0));
+        stream_printf(GDKout, "cp2Container:        %10.2f msec\n",
+                (time_cp2Container/1000.0));
+    }
+
     if(out) { /* serialize projected nodes to file */
+        lng time_projSeria = GDKusec(); /* start timer */
+
         kind = SET_CONT_KIND(contIDnew, ELEM);
         if(!(print_kind = BUNappend(BATnew(TYPE_void, TYPE_int, 1), &kind, 
FALSE))) {
             GDKerror("runtime_doc_projection: failed to create 'print_kind' 
BAT\n");
@@ -1042,9 +1068,16 @@
         BBPreclaim(print_iter);
         BBPreclaim(print_item);
         BBPreclaim(print_kind);
+
+        time_projSeria = GDKusec() - time_projSeria; /* stop timer */
+        if(options && strstr(options, "timing")) {
+            stream_printf(GDKout, "ProjSeria: %10.2f msec\n",
+                    (time_projSeria/1000.0));
+        }
     }
 
     GDKfree(ctx->pre); GDKfree(ctx->knd); GDKfree(ctx);
+
     return status;
 }
 


-------------------------------------------------------------------------
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

Reply via email to