Changeset: 8923c0930e7d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8923c0930e7d
Modified Files:
        clients/mapiclient/tomograph.c
        monetdb5/mal/mal_profiler.c
Branch: default
Log Message:

Fixing attach to hot system with tomograph
Tomograp has to skip beyond any initialization phase before it
should start counting the number queries seen.
For this purpose, we sent a marker test against which we can
start the real count down.


diffs (71 lines):

diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -56,6 +56,7 @@
 
 #define COUNTERSDEFAULT "ISTestmrw"
 
+#define TOMOGRAPHPATTERN "tomograph start 2012"
 /* #define _DEBUG_TOMOGRAPH_*/
 
 static struct {
@@ -131,6 +132,7 @@ static int beat= 50;
 static Mapi dbh = NULL;
 static MapiHdl hdl = NULL;
 static int batch = 1; /* number of queries to combine in one run */
+static int startup= 0; /* count openStream calls first */
 static long maxio=0;
 static int cpus = 0;
 
@@ -215,6 +217,8 @@ static void activateBeat(void){
        char *id ="activateBeat";
        snprintf(buf, BUFSIZ, "profiler.activate(\"ping%d\");\n",beat);
        doQ(buf);
+       snprintf(buf, BUFSIZ, "io.print(\"%s\");\n",TOMOGRAPHPATTERN);
+       doQ(buf);
        return;
 stop_disconnect:
        mapi_disconnect(dbh);
@@ -1006,7 +1010,7 @@ static void update(int state, int thread
                return;
        }
 
-       if (state == 1 && fcn && (strncmp(fcn,"function",8) == 0 || 
strncmp(fcn,"profiler.tomograph",18) == 0 )){
+       if (state == 1 && fcn && (strncmp(fcn,"function",8) == 0 || 
strncmp(fcn,"profiler.tomograph",18) == 0)  && startup > 1 ){
                deactivateBeat();
                createTomogram();
                totalclkticks= 0; /* number of clock ticks reported */
@@ -1150,6 +1154,12 @@ static void parser(char *row){
        c = strchr(c+1, (int)',');
        c++;
        fcn = c;
+       if (fcn && strstr(fcn, TOMOGRAPHPATTERN) ){
+               startup++;      // start counting 
+               if (debug)
+                       printf("Found start marker\n");
+               if ( startup == 2 ) batch++;
+       }
        stmt = strdup(fcn);
        c = strstr(c+1, ":=");
        if ( c ){
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -125,11 +125,12 @@ activateCounter(str name)
                if (strcmp(profileCounter[i].name, name) == 0) {
                        profileCounter[i].status = 1;
                        return 0;
-               } else
-               if ( strncmp("ping",name,4) == 0){
-                       startHeartbeat(atoi(name+4));
-                       return 0;
-               }
+               } 
+       if ( strncmp("ping",name,4) == 0){
+               startHeartbeat(atoi(name+4));
+               profileCounter[PROFping].status = 1;
+               return 0;
+       }
        throw(MAL, "activateCounter", RUNTIME_OBJECT_UNDEFINED ":%s", name);
 }
 
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to