Changeset: f9224d1f17d9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9224d1f17d9
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        monetdb5/mal/mal_profiler.c
        monetdb5/modules/mal/profiler.c
        monetdb5/modules/mal/profiler.mal
Branch: default
Log Message:

Make the HIGHWATER mark a compiled issue. It skips
profiling instructions that are likely part of a large BARRIER loop


diffs (147 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11522,11 +11522,9 @@ stdout of test 'MAL-signatures` in direc
 [ "profiler",  "getSystemTime",        "command profiler.getSystemTime():lng 
",        "CMDgetSystemTime;",    "Obtain the user timing information."   ]
 [ "profiler",  "getTrace",     "pattern profiler.getTrace(e:str):bat[:any_1] 
",        "CMDgetTrace;", "Get the trace details of a specific event"     ]
 [ "profiler",  "getUserTime",  "command profiler.getUserTime():lng ",  
"CMDgetUserTime;",      "Obtain the user timing information."   ]
-[ "profiler",  "getlimit",     "command profiler.getlimit():int ",     
"CMDgetprofilerlimit;", "Avoid floading of events"      ]
 [ "profiler",  "noop", "command profiler.noop():void ",        
"CMDnoopProfiler;",     "Fetch any pending performance events"  ]
 [ "profiler",  "openstream",   "pattern profiler.openstream(mode:int):void ",  
"CMDopenProfilerStream;",       "Start profiling the events, send to output 
stream"     ]
 [ "profiler",  "setheartbeat", "command profiler.setheartbeat(b:int):void ",   
"CMDsetHeartbeat;",     "Set heart beat performance tracing"    ]
-[ "profiler",  "setlimit",     "command profiler.setlimit(i:int):void ",       
"CMDsetprofilerlimit;", "Change the profiler event limit counter"       ]
 [ "profiler",  "start",        "pattern profiler.start():void ",       
"CMDstartProfiler;",    "Start offline performance profiling"   ]
 [ "profiler",  "starttrace",   "pattern profiler.starttrace():void ",  
"CMDstartTrace;",       "Start collecting trace information"    ]
 [ "profiler",  "starttrace",   "pattern profiler.starttrace(path:str):void ",  
"CMDstartTracePath;",   "Start collecting trace information and keep around in 
'path' directory"        ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -15926,11 +15926,9 @@ stdout of test 'MAL-signatures` in direc
 [ "profiler",  "getSystemTime",        "command profiler.getSystemTime():lng 
",        "CMDgetSystemTime;",    "Obtain the user timing information."   ]
 [ "profiler",  "getTrace",     "pattern profiler.getTrace(e:str):bat[:any_1] 
",        "CMDgetTrace;", "Get the trace details of a specific event"     ]
 [ "profiler",  "getUserTime",  "command profiler.getUserTime():lng ",  
"CMDgetUserTime;",      "Obtain the user timing information."   ]
-[ "profiler",  "getlimit",     "command profiler.getlimit():int ",     
"CMDgetprofilerlimit;", "Avoid floading of events"      ]
 [ "profiler",  "noop", "command profiler.noop():void ",        
"CMDnoopProfiler;",     "Fetch any pending performance events"  ]
 [ "profiler",  "openstream",   "pattern profiler.openstream(mode:int):void ",  
"CMDopenProfilerStream;",       "Start profiling the events, send to output 
stream"     ]
 [ "profiler",  "setheartbeat", "command profiler.setheartbeat(b:int):void ",   
"CMDsetHeartbeat;",     "Set heart beat performance tracing"    ]
-[ "profiler",  "setlimit",     "command profiler.setlimit(i:int):void ",       
"CMDsetprofilerlimit;", "Change the profiler event limit counter"       ]
 [ "profiler",  "start",        "pattern profiler.start():void ",       
"CMDstartProfiler;",    "Start offline performance profiling"   ]
 [ "profiler",  "starttrace",   "pattern profiler.starttrace():void ",  
"CMDstartTrace;",       "Start collecting trace information"    ]
 [ "profiler",  "starttrace",   "pattern profiler.starttrace(path:str):void ",  
"CMDstartTracePath;",   "Start collecting trace information and keep around in 
'path' directory"        ]
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
@@ -37,7 +37,11 @@ static int eventcounter = 0;
  * each key:value pair or as a single line using ' '*/
 #define PRETTIFY       "\n"
 
-static int highwatermark = 5;  // conservative initialization
+/* When the MAL block contains a BARRIER block we may end up with tons
+ * of profiler events. To avoid this, we stop emitting the events
+ * when we reached the HIGHWATERMARK. Leaving a message in the log. */
+#define HIGHWATERMARK 5
+
 
 int malProfileMode = 0;     /* global flag to indicate profiling mode */
 
@@ -50,10 +54,6 @@ struct rusage infoUsage;
 static struct rusage prevUsage;
 #endif
 
-static struct{
-       lng user, nice, system, idle, iowait;
-       double load;
-} corestat[256];
 
 
 /* the heartbeat process produces a ping event once every X milliseconds */
@@ -147,8 +147,11 @@ renderProfilerEvent(Client cntxt, MalBlk
         * they may appear when BARRIER blocks are executed
         * The default parameter should be sufficient for most practical cases.
        */
-       if( !start && pci->calls > highwatermark)
+       if( !start && pci->calls > HIGHWATERMARK){
+               if( pci->calls == 10000 || pci->calls == 100000 || pci->calls 
== 1000000 || pci->calls == 10000000)
+                       fprintf(stderr, "#Profiler too many calls %d\n", 
pci->calls);
                return;
+       }
 
        /* make profile event tuple  */
        lognew();
@@ -388,6 +391,15 @@ This information can be used to determin
        logjsonInternal(logbuffer);
 }
 
+/* the OS details on cpu load are read from /proc/stat
+ * We should use an OS define to react to the maximal cores
+ */
+
+static struct{
+       lng user, nice, system, idle, iowait;
+       double load;
+} corestat[256];
+
 static int
 getCPULoad(char cpuload[BUFSIZ]){
     int cpu, len = 0, i;
@@ -808,17 +820,6 @@ sqlProfilerEvent(Client cntxt, MalBlkPtr
        GDKfree(stmt);
 }
 
-int getprofilerlimit(void)
-{
-       return highwatermark;
-}
-
-void setprofilerlimit(int limit)
-{
-       // dont lock, it is advisary anyway
-       highwatermark = limit;
-}
-
 lng
 getDiskWrites(void)
 {
diff --git a/monetdb5/modules/mal/profiler.c b/monetdb5/modules/mal/profiler.c
--- a/monetdb5/modules/mal/profiler.c
+++ b/monetdb5/modules/mal/profiler.c
@@ -160,21 +160,6 @@ CMDsetHeartbeat(void *res, int *ev)
 }
 
 str
-CMDgetprofilerlimit(int *res)
-{
-       *res = getprofilerlimit();
-       return MAL_SUCCEED;
-}
-
-str
-CMDsetprofilerlimit(void *res, int *ev)
-{
-       (void) res;
-       setprofilerlimit(*ev);
-       return MAL_SUCCEED;
-}
-
-str
 CMDgetDiskReads(lng *ret)
 {
        *ret= getDiskReads();
diff --git a/monetdb5/modules/mal/profiler.mal 
b/monetdb5/modules/mal/profiler.mal
--- a/monetdb5/modules/mal/profiler.mal
+++ b/monetdb5/modules/mal/profiler.mal
@@ -34,14 +34,6 @@ command setheartbeat(b:int):void
 address CMDsetHeartbeat
 comment "Set heart beat performance tracing";
 
-command getlimit():int
-address CMDgetprofilerlimit
-comment "Avoid floading of events";
-
-command setlimit(i:int)
-address CMDsetprofilerlimit
-comment "Change the profiler event limit counter";
-
 pattern openstream(mode:int):void
 address CMDopenProfilerStream
 comment "Start profiling the events, send to output stream";
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to