Changeset: f4fc50291cd7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4fc50291cd7
Modified Files:
        clients/mapiclient/eventparser.c
        clients/mapiclient/eventparser.h
        clients/mapiclient/stethoscope.c
        monetdb5/mal/mal_profiler.c
Branch: profiler
Log Message:

Add clk event
The clk event gives the number of usec since server start
The old timing event is available as 'ctime'


diffs (66 lines):

diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -106,7 +106,7 @@ resetEventRecord(EventRecord *ev)
        if( ev->package) free(ev->package);
 
        if( ev->function) free(ev->function);
-       if( ev->clk) free(ev->clk);
+       if( ev->time) free(ev->time);
        if( ev->stmt) free(ev->stmt);
        if( ev->fcn) free(ev->fcn);
        if( ev->numa) free(ev->numa);
@@ -202,9 +202,13 @@ keyvalueparser(char *txt, EventRecord *e
        } else val =c;
 
        if( strstr(key,"event")) { ev->eventnr= atol(val); return 0;}
-       if( strstr(key,"time")){
+       if( strstr(key,"clk")){
+               ev->clk = atoll(val); 
+               return 0;
+       }
+       if( strstr(key,"ctime")){
                /* convert time to epoch in seconds*/
-               ev->clk= strdup(val);
+               ev->time= strdup(val);
                memset(&stm, 0, sizeof(struct tm));
                c = strptime(val + 1, "%H:%M:%S", &stm);
                ev->clkticks = (((lng) stm.tm_hour * 60 + stm.tm_min) * 60 + 
stm.tm_sec) * 1000000;
diff --git a/clients/mapiclient/eventparser.h b/clients/mapiclient/eventparser.h
--- a/clients/mapiclient/eventparser.h
+++ b/clients/mapiclient/eventparser.h
@@ -82,7 +82,8 @@ typedef struct  {
        int tag;        // unique MAL block invocation tag
        lng eventnr;// serial event number
        int thread;     // worker thread involved
-       char *clk;      // string rep of clock
+       lng clk;        // usec since start of session
+       char *time;     // string rep of clock
        lng clkticks;
        lng ticks;
        lng rss;
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -110,7 +110,7 @@ renderEvent(EventRecord *ev){
                return;
        fprintf(s, "[ ");
        fprintf(s, LLFMT",      ", ev->eventnr);
-       fprintf(s, "\"%s\",     ", ev->clk);
+       printf("\"%s\", ", ev->time);
        if( ev->function && *ev->function)
                fprintf(s, "\"%s[%d]%d\",       ", ev->function, ev->pc, 
ev->tag);
        else
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
@@ -144,7 +144,8 @@ renderProfilerEvent(MalBlkPtr mb, MalStk
        tbuf[19]=0;
        /* there should be less than 10^6 == 1M usecs in 1 sec */
        assert(clock.tv_usec >= 0 && clock.tv_usec < 1000000);
-       logadd("\"time\":\"%s.%06ld\",\n", tbuf+11, (long)clock.tv_usec);
+       logadd("\"clk\":"LLFMT",\n",GDKusec());
+       logadd("\"ctime\":\"%s.%06ld\",\n", tbuf+11, (long)clock.tv_usec);
        logadd("\"thread\":%d,\n", THRgettid());
 
        logadd("\"function\":\"%s.%s\",\n", getModuleId(getInstrPtr(mb, 0)), 
getFunctionId(getInstrPtr(mb, 0)));
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to