Changeset: df013c5eef64 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=df013c5eef64
Modified Files:
        sql/backends/monet5/sql.mx
Branch: sciql
Log Message:

merged from default


diffs (267 lines):

diff --git a/clients/mapiclient/Tests/stethoscope--help.stable.err 
b/clients/mapiclient/Tests/stethoscope--help.stable.err
--- a/clients/mapiclient/Tests/stethoscope--help.stable.err
+++ b/clients/mapiclient/Tests/stethoscope--help.stable.err
@@ -21,10 +21,10 @@ The trace options:
   S = monitor start of instruction profiling
   a = aggregate clock ticks per instruction
   e = event counter
-  f = function name and pc counter 
-  o = module.function operation called
-  i = interpreter thread number
-  T = wall colck time
+  f = module.function name
+  i = instruction counter
+  I = interpreter thread number
+  T = wall clock time
   t = ticks in microseconds
   c = cpu statistics (utime,ctime,stime,cstime)
   m = memory resources as provided by OS
@@ -35,6 +35,7 @@ The trace options:
   y = MAL argument types
   p = process statistics, e.g. page faults, context switches
   u = user id
+  D = Generate dot file upon query start
 
 # 19:24:05 >  
 # 19:24:05 >  "Done."
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -19,54 +19,7 @@
 
 /**
  * stethoscope
- * Martin Kersten
- *
- * The Stethoscope
- * The performance profiler infrastructure provides
- * precisely control through annotation of a MAL program. 
- * Often, however, inclusion of profiling statements is an afterthought.
- *
- * The program stethoscope addresses this situation by providing
- * a simple application that can attach itself to a running
- * server and extracts the profiler events from concurrent running queries.
- *
- * The arguments to @code{stethoscope} are the profiler properties to be traced
- * and the applicable filter expressions. For example,
- *   stethoscope -t bat.insert algebra.join
- * tracks the microsecond ticks of two specific MAL instructions.
- * A synopsis of the calling conventions:
- *   stethoscope [options] +[aefoTtcmibds] @{<mod>.<fcn> @}
- *     -d | --dbname=<database_name>
- *     -u | --user=<user>
- *     -P | --password=<password>
- *     -p | --port=<portnr>
- *     -h | --host=<hostname>
- * 
- * Event selector:
- *     a =aggregates
- *     e =event
- *     f =function 
- *     i =instruction counter
- *     I =interpreter thread
- *     T =time
- *     t =ticks
- *     c =cpu statistics
- *     m =memory resources
- *     r =block reads
- *     w =block writes
- *     b =bytes read/written
- *     s =statement
- *     y =argument types
- *     p =pgfaults,cntxtswitches
- *     S =Start profiling instruction
- *     D =Generate dot file upon query start
- * 
- * Ideally, the stream of events should be piped into a
- * 2D graphical tool, like xosview (Linux).
- * 
- * For a convenient way to watch most of the SQL interaction you may use
- * the command:
- * stethoscope -umonetdb -Pmonetdb -hhost +tis "algebra.*" "bat.*" "group.*" 
"sql.*" "aggr.*"
+ * author Martin Kersten
  */
 
 #include "monetdb_config.h"
@@ -91,6 +44,7 @@
 # endif
 #endif
 
+#define COUNTERSDEFAULT "ISTest"
 
 static struct {
        char tag;
@@ -131,6 +85,7 @@ static struct {
        /*  0  */ { 'S', "start", "start", 0 },
        /*  1  */ { 'y', "type", "type", 0 },
        /*  2  */ { 'D', "dot", "dot", 0 },
+       /*  3  */ { 'F', "flow", "flow", 0 },
        /*  3  */ { 0, 0, 0, 0 }
 };
 
@@ -162,7 +117,7 @@ usage(void)
        fprintf(stderr, "  -p | --port=<portnr>\n");
        fprintf(stderr, "  -h | --host=<hostname>\n");
        fprintf(stderr, "\n");
-       fprintf(stderr, "The trace options:\n");
+       fprintf(stderr, "The trace options (default '%s'):\n",COUNTERSDEFAULT);
        fprintf(stderr, "  S = monitor start of instruction profiling\n");
        fprintf(stderr, "  a = aggregate clock ticks per instruction\n");
        fprintf(stderr, "  e = event counter\n");
@@ -181,6 +136,7 @@ usage(void)
        fprintf(stderr, "  p = process statistics, e.g. page faults, context 
switches\n");
        fprintf(stderr, "  u = user id\n");
        fprintf(stderr, "  D = Generate dot file upon query start\n");
+       fprintf(stderr, "  F = dataflow memory claims (in MB)\n");
 }
 
 /* Any signal should be captured and turned into a graceful
@@ -408,7 +364,7 @@ main(int argc, char **argv)
                k= setCounter(argv[a] + 1);
                a++;
        } else
-               k= setCounter("TtesDSI");
+               k= setCounter(COUNTERSDEFAULT);
 
        /* DOT needs function id and PC to correlate */
        if( profileCounter[32].status ) {
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -45,13 +45,16 @@
  * @
  */
 #define MAXSCRIPT 64
+#define MEMORY_THRESHOLD  0.8
 
-mal_export char            monet_cwd[PATHLENGTH];
-mal_export int             monet_welcome;
-mal_export str             *monet_script;
-mal_export int                                 monet_daemon;
-mal_export size_t                      monet_memory;
-mal_export int                         nrservers;
+mal_export char     monet_cwd[PATHLENGTH];
+mal_export int      monet_welcome;
+mal_export str      *monet_script;
+mal_export int                 monet_daemon;
+mal_export size_t      monet_memory;
+mal_export int         nrservers;
+mal_export lng                 memorypool;      /* memory claimed by 
concurrent threads */
+mal_export int                 memoryclaims;    /* number of threads active 
with expensive operations */
 
 #define mal_set_lock(X,Y) if(GDKprotected) MT_lock_set(&X,Y)
 #define mal_unset_lock(X,Y) if(GDKprotected) MT_lock_unset(&X,Y)
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -1108,11 +1108,11 @@ showFlowGraph(MalBlkPtr mb, MalStkPtr st
                if (idcmp(fname, "stethoscope") != 0) {
                        mnstr_close(f);
                        buffer_destroy(bufstr);
-               } else sleep(4000); /* delay for stethoscope */
+               } else MT_sleep_ms(4000); /* delay for stethoscope */
        } else if (f != GDKout) {
                if (idcmp(fname, "stethoscope") != 0) 
                        mnstr_close(f);
-               else sleep(4000); /* delay for stethoscope */
+               else MT_sleep_ms(4000); /* delay for stethoscope */
        }
 }
 
diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -78,13 +78,11 @@ mal_export ptr getArgReference(MalStkPtr
 static str runMALsequence(Client cntxt, MalBlkPtr mb, int startpc, int stoppc, 
MalStkPtr stk, MalStkPtr env, InstrPtr pcicaller);
 static void displayVolume(Client cntxt, lng vol);
 
-#define MEMORY_THRESHOLD  0.8
-
 #define USE_DFLOW_ADMISSION
+/* does not seem to have a major impact */
+lng memorypool = 0;      /* memory claimed by concurrent threads */
+int memoryclaims = 0;    /* number of threads active with expensive operations 
*/
 #ifdef USE_DFLOW_ADMISSION
-/* does not seem to have a major impact */
-static lng memorypool;      /* memory claimed by concurrent threads */
-static int memoryclaims = 0;    /* number of threads active with expensive 
operations */
 mal_export int DFLOWadmission(lng argclaim, lng hotclaim);
 #endif
 
diff --git a/monetdb5/mal/mal_profiler.mx b/monetdb5/mal/mal_profiler.mx
--- a/monetdb5/mal/mal_profiler.mx
+++ b/monetdb5/mal/mal_profiler.mx
@@ -346,6 +346,7 @@ static int delayswitch = 0; /* to wait b
 #define PROFstart   16
 #define PROFtype    17
 #define PROFdot     18
+#define PROFflow   19
 
 static struct {
        str name;               /* which logical counter is needed */
@@ -370,7 +371,8 @@ static struct {
        /*  16 */  { "start", 0},
        /*  17 */  { "type", 0},
        /*  18 */  { "dot", 0},
-       /*  19 */  { 0, 0}
+       /*  19 */  { "flow", 0},
+       /*  20 */  { 0, 0}
 };
 
 /*
@@ -464,6 +466,8 @@ offlineProfilerHeader(void)
        if (profileCounter[PROFthread].status) {
                log0("thread,\t");
        }
+       if (profileCounter[PROFflow].status)
+               log0("claim,\tmemory,\t");
        if (profileCounter[PROFfunc].status) {
                log0("function,\t");
        }
@@ -562,7 +566,11 @@ offlineProfilerEvent(int idx, MalBlkPtr 
                log("%d,\t", eventcounter);
        }
        if (profileCounter[PROFstart].status) {
-               log("\"%s\",\t", start?"start":"done");
+               if ( start) {
+                       log0("\"start\",\t");
+               } else {
+                       log0("\"done\" ,\t");
+               }
        }
        if (profileCounter[PROFtime].status) {
                char *tbuf, *c;
@@ -586,6 +594,10 @@ offlineProfilerEvent(int idx, MalBlkPtr 
        if (profileCounter[PROFthread].status) {
                log(" %d,\t", THRgettid());
        }
+       if (profileCounter[PROFflow].status) {
+               log("%d,\t", memoryclaims);
+               log(LLFMT",\t", memoryclaims?((lng)(MEMORY_THRESHOLD * 
monet_memory)-memorypool)/1024/1024:0);
+       }
        if (profileCounter[PROFfunc].status) {
                if (getModuleId(pci) && getFunctionId(pci)) {
                        log2("\"%s.%s\",\t",
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -101,7 +101,7 @@ pattern include(fname:str):void
 address SQLinclude
 comment "Compile and execute a sql statements on the file";
 
-pattern ra(cmd:str, optimize:bit):void
+pattern evalAlgebra(cmd:str, optimize:bit):void
 address RAstatement
 comment "Compile and execute a single 'relational algebra' statement";
 
diff --git a/sql/scripts/25_debug.sql b/sql/scripts/25_debug.sql
--- a/sql/scripts/25_debug.sql
+++ b/sql/scripts/25_debug.sql
@@ -51,5 +51,5 @@ create function bbp ()
                status string, kind string) 
        external name sql.bbp;
 
-create procedure ra( ra_stmt string, opt bool)
-       external name sql.ra;
+create procedure evalAlgebra( ra_stmt string, opt bool)
+       external name sql."evalAlgebra";
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to