Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7273

Modified Files:
        milprint_summer.c 
Log Message:
- Added a very simple time/size profiler for builtin functions.
  Use the DO_PROFILE switch to switch on the profiler.
  



Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.397
retrieving revision 1.398
diff -u -d -r1.397 -r1.398
--- milprint_summer.c   17 Jul 2007 09:11:34 -0000      1.397
+++ milprint_summer.c   17 Jul 2007 12:45:06 -0000      1.398
@@ -117,6 +117,8 @@
 /* starting level of global variables */
 #define GLO_LEV -1
 
+/* #define DO_PROFILE 1 */
+
 /**
  * mps_error calls PFoops with more text, since something is wrong
  * in the translation, if this message appears.
@@ -9092,8 +9094,19 @@
         case c_apply:
             if (c->sem.fun->builtin)
             {
+#ifdef DO_PROFILE
+               milprintf(f,"var txxx := usec();\n");
+#endif
                 rc = translateFunction (f, code, cur_level, counter, 
                                         c->sem.fun, D(c));
+#ifdef DO_PROFILE
+               milprintf(f,
+                       "var tc := usec() - txxx;\n" 
+                       "prof_fun_time.insert(\"%s\",tc);\n"
+                       "printf(\"+ F[%s]:\\ttime=%% 8.3f ms. items=%% 
d\\n\",dbl(tc)/1000.0,item.count());\n"
+                       "\n"
+               ,PFqname_loc (c->sem.fun->qname),PFqname_loc 
(c->sem.fun->qname));
+#endif
             }
             else
             {
@@ -11421,6 +11434,9 @@
    "module(\"probxml\");\n"
    "var newid_counter := 1LL;\n"
 #endif
+#ifdef DO_PROFILE
+   "var prof_fun_time := new(str,lng);\n"
+#endif
         "\n"
         "# value containers for literal values\n"
         "var int_values := bat(lng,void).key(true).reverse().seqbase([EMAIL 
PROTECTED]);\n"
@@ -11585,6 +11601,8 @@
            "  time_print := usec() - time_print;\n"\
            "  printf(\"\\nTrans  %% 10.3f msec\\nShred  %% 10.3f msec\\nQuery  
%% 10.3f msec\\n" LASTPHASE " %% 10.3f msec\\n\","\
            "      dbl(time_compile)/1000.0, dbl(time_shred)/1000.0, 
dbl(time_exec - time_shred)/1000.0, time_print/1000.0);\n}"
+
+
 const char* PFstopMIL(int statement_type) {
     return (statement_type==0)?
                (PF_STOPMIL_RDONLY):
@@ -11737,6 +11755,9 @@
         timing = PFtimer_stop(timing);
         milprintf(f, "iter := [EMAIL PROTECTED];\n");
         milprintf(f, "time_compile := %dLL;\n" , timing);
+#ifdef DO_PROFILE
+        milprintf(f, "{sum}(prof_fun_time).print();\n");
+#endif
         milprintf(f, PFstopMIL(stmt));
     }
 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to