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

Profiler changes
- only stop creation/sending events within the profiler
- add view properties to the JSON trace for offline analyse


diffs (119 lines):

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
@@ -31,6 +31,8 @@ static str myname = 0;        // avoid tracing 
 static int eventcounter = 0;
 static str prettify = "\n"; /* or ' ' for single line json output */
 
+static int highwatermark = 5;  // conservative initialization
+
 static int TRACE_init = 0;
 int malProfileMode = 0;     /* global flag to indicate profiling mode */
 
@@ -111,6 +113,9 @@ renderProfilerEvent(MalBlkPtr mb, MalStk
        lng usec= GDKusec();
 
 
+       // ignore generation of events for instructions that are called too 
often
+       if(highwatermark && highwatermark + (start == 0) < pci->calls)
+               return;
        if( start) // show when instruction was started
                clock = pci->clock;
        else 
@@ -276,9 +281,17 @@ This information can be used to determin
                                        tname = getTypeName(getBatType(tpe));
                                        logadd("\"type\":\"bat[:%s]\",%s", 
tname,pret);
                                        if( d) {
-                                               //if( isVIEW(d))
-                                                       //bid = VIEWtparent(d);
+                                               BAT *v;
                                                cnt = BATcount(d);
+                                               if( isVIEW(d)){
+                                                       
logadd("\"view\":\"true\",%s", pret);
+                                                       
logadd("\"parent\":\"%d\",%s", VIEWtparent(d), pret);
+                                                       
logadd("\"seqbase\":\""BUNFMT"\",%s", d->hseqbase, pret);
+                                                       
logadd("\"hghbase\":\""BUNFMT"\",%s", d->hseqbase + cnt, pret);
+                                                       v= 
BBPquickdesc(VIEWtparent(d),0);
+                                                       
logadd("\"kind\":\"%s\",%s", ( v->batPersistence == PERSISTENT ? 
"persistent":"transient"), pret);
+                                               } else
+                                                       
logadd("\"kind\":\"%s\",%s", ( d->batPersistence == PERSISTENT ? 
"persistent":"transient"), pret);
                                                total += cnt * d->twidth;
                                                total += heapinfo(d->tvheap, 
d->batCacheid); 
                                                total += hashinfo(d->thash, 
d->batCacheid); 
@@ -890,8 +903,6 @@ cachedProfilerEvent(MalBlkPtr mb, MalStk
        GDKfree(stmt);
 }
 
-static int highwatermark = 5;  // conservative initialization
-
 int getprofilerlimit(void)
 {
        return highwatermark;
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -60,7 +60,6 @@ runtimeProfileInit(Client cntxt, MalBlkP
 {
        int i;
        str q;
-       InstrPtr p;
 
        MT_lock_set(&mal_delayLock);
        if ( QRYqueue == 0)
@@ -93,15 +92,6 @@ runtimeProfileInit(Client cntxt, MalBlkP
 
        qtop += i == qtop;
 
-       if( getprofilerlimit()){
-               // reset the counters before continuing
-               for ( i = 0; i< mb->stop; i++){
-                       p= getInstrPtr(mb,i);
-                       p->calls = 0;
-                       p->ticks = 0;
-                       p->totticks = 0;
-               }
-       }
        MT_lock_unset(&mal_delayLock);
 }
 
@@ -177,17 +167,15 @@ runtimeProfileBegin(Client cntxt, MalBlk
        }
 
        /* always collect the MAL instruction execution time */
-       if( pci->calls < getprofilerlimit() ){
-               gettimeofday(&pci->clock,NULL);
-               prof->ticks = GDKusec();
-       }
+       gettimeofday(&pci->clock,NULL);
+       prof->ticks = GDKusec();
 
        /* keep track of actual running instructions over BATs */
        if( isaBatType(getArgType(mb, pci, 0)) )
                (void) ATOMIC_INC(mal_running, mal_runningLock);
 
        /* emit the instruction upon start as well */
-       if(malProfileMode > 0 && pci->calls < getprofilerlimit())
+       if(malProfileMode > 0 )
                profilerEvent(mb, stk, pci, TRUE, cntxt->username);
 }
 
@@ -208,14 +196,12 @@ runtimeProfileExit(Client cntxt, MalBlkP
                (void) ATOMIC_DEC(mal_running, mal_runningLock);
 
        assert(prof);
-       /* always collect the MAL instruction execution time unless you hit the 
profiler high water mark */
-       if( pci->calls < getprofilerlimit()){
-               pci->ticks = GDKusec() - prof->ticks;
-               pci->totticks += pci->ticks;
-               pci->calls++;
-       }
+       /* always collect the MAL instruction execution time */
+       pci->ticks = GDKusec() - prof->ticks;
+       pci->totticks += pci->ticks;
+       pci->calls++;
        
-       if(malProfileMode > 0 && pci->calls < getprofilerlimit()){
+       if(malProfileMode > 0 ){
                pci->wbytes += getVolume(stk, pci, 1);
                pci->rbytes += getVolume(stk, pci, 0);
                profilerEvent(mb, stk, pci, FALSE, cntxt->username);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to