Changeset: e77c6bb8caa5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e77c6bb8caa5
Modified Files:
        clients/Tests/MAL-signatures-hge.test
        clients/Tests/exports.stable.out
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_profiler.h
        monetdb5/modules/mal/profiler.c
Branch: default
Log Message:

Cleanup profiler module: remove cleanup, remove some locking.


diffs (137 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -49204,11 +49204,6 @@ command pcre.sql2pcre(X_0:str, X_1:str):
 PCREsql2pcre
 Convert a SQL like pattern with the given escape character into a PCRE pattern.
 profiler
-cleanup
-unsafe pattern profiler.cleanup():void
-CMDcleanupTraces
-Remove the temporary tables for profiling
-profiler
 closestream
 pattern profiler.closestream():void
 CMDcloseProfilerStream
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -864,7 +864,6 @@ int chkInstruction(Module s, MalBlkPtr m
 str chkProgram(Module s, MalBlkPtr mb);
 str chkTypes(Module s, MalBlkPtr mb, int silent);
 const char claimRef[];
-void clearTrace(Client cntxt);
 void clearVariable(MalBlkPtr mb, int varid);
 const char clear_tableRef[];
 int cloneVariable(MalBlkPtr dst, MalBlkPtr src, int varid);
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
@@ -762,6 +762,7 @@ closeProfilerStream(Client cntxt)
 
 /* SQL tracing is simplified, because it only collects the events in the 
temporary table.
  */
+static void clearTrace(Client cntxt);
 str
 startTrace(Client cntxt)
 {
@@ -820,9 +821,7 @@ TRACEcreate(int tt)
 static void
 initTrace(Client cntxt)
 {
-       MT_lock_set(&mal_profileLock);
        if (cntxt->profticks) {
-               MT_lock_unset(&mal_profileLock);
                return;                                 /* already initialized 
*/
        }
        cntxt->profticks = TRACEcreate(TYPE_lng);
@@ -831,7 +830,6 @@ initTrace(Client cntxt)
        if (cntxt->profticks == NULL || cntxt->profstmt == NULL
                || cntxt->profevents == NULL)
                _cleanupProfiler(cntxt);
-       MT_lock_unset(&mal_profileLock);
 }
 
 int
@@ -861,29 +859,17 @@ TRACEtable(Client cntxt, BAT **r)
        return 3;
 }
 
-void
+static void
 clearTrace(Client cntxt)
 {
        (void) cntxt;
-       MT_lock_set(&mal_profileLock);
-       if (cntxt->profticks == NULL) {
-               MT_lock_unset(&mal_profileLock);
-               initTrace(cntxt);
-               return;                                 /* not initialized */
+       if (cntxt->profticks != NULL) {
+               /* drop all trace tables */
+               _cleanupProfiler(cntxt);
        }
-       /* drop all trace tables */
-       _cleanupProfiler(cntxt);
-       MT_lock_unset(&mal_profileLock);
        initTrace(cntxt);
 }
 
-str
-cleanupTraces(Client cntxt)
-{
-       clearTrace(cntxt);
-       return MAL_SUCCEED;
-}
-
 void
 sqlProfilerEvent(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci,
                                 lng clk, lng ticks)
diff --git a/monetdb5/mal/mal_profiler.h b/monetdb5/mal/mal_profiler.h
--- a/monetdb5/mal/mal_profiler.h
+++ b/monetdb5/mal/mal_profiler.h
@@ -56,7 +56,6 @@ mal_export oid runtimeProfileSetTag(Clie
 
 mal_export str startTrace(Client cntxt);
 mal_export str stopTrace(Client cntxt);
-mal_export void clearTrace(Client cntxt);
 mal_export int TRACEtable(Client cntxt, BAT **r);
 
 #ifdef LIBMONETDB5
@@ -74,8 +73,6 @@ extern void setprofilerlimit(int limit);
 
 extern void MPresetProfiler(stream *fdout);
 
-extern str cleanupTraces(Client cntxt);
-
 extern lng getDiskSpace(void);
 extern void profilerGetCPUStat(lng *user, lng *nice, lng *sys, lng *idle,
                                                           lng *iowait);
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
@@ -71,16 +71,6 @@ CMDcloseProfilerStream(Client cntxt, Mal
        return closeProfilerStream(cntxt);
 }
 
-static str
-CMDcleanupTraces(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-       (void) mb;
-       (void) stk;
-       (void) pci;
-       cleanupTraces(cntxt);
-       return MAL_SUCCEED;
-}
-
 /*
  * Tracing an active system.
  */
@@ -128,7 +118,6 @@ mel_func profiler_init_funcs[] = {
 
  pattern("profiler", "closestream", CMDcloseProfilerStream, false, "Stop 
offline profiling", args(1,1, arg("",void))),
 
- pattern("profiler", "cleanup", CMDcleanupTraces, true, "Remove the temporary 
tables for profiling", args(1,1, arg("",void))),
  command("profiler", "cpustats", CMDcpustats, false, "Extract cpu statistics 
from the kernel", args(5,5, 
arg("user",lng),arg("nice",lng),arg("sys",lng),arg("idle",lng),arg("iowait",lng))),
  command("profiler", "cpuload", CMDcpuloadPercentage, false, "Calculate the 
average cpu load percentage and io waiting times", args(2,7, 
arg("cycles",int),arg("io",int),arg("user",lng),arg("nice",lng),arg("sys",lng),arg("idle",lng),arg("iowait",lng))),
  { .imp=NULL }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to