Changeset: 5f2fd87068d9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5f2fd87068d9
Modified Files:
        monetdb5/mal/mal_profiler.c
        monetdb5/modules/mal/profiler.c
Branch: Sep2022
Log Message:

Better logic to handle openstream call.


diffs (44 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
@@ -692,10 +692,20 @@ openProfilerStream(Client cntxt, int m)
                        throw(MAL,"profiler.start","Profiler already running, 
stream not available");
                }
        }
-       profilerStatus = -1;
-       /* 4 activates minimal mode. 1 and 3 were used in prev MonetDB versions 
*/
-       /* else default is 0 of global var profilerMode */
-       if (m == 4) profilerMode = 1;
+       /* 4 activates profiler in minimal mode. 1 and 3 were used in prev 
MonetDB versions */
+       /* 0 activates profiler in detailed mode */
+       switch (m) {
+           case 0:
+                       profilerStatus = -1;
+                       break;
+           case 4:
+                       profilerStatus = -1;
+                       profilerMode = 1;
+                       break;
+           default:
+                       MT_lock_unset(&mal_profileLock);
+                       throw(MAL,"profiler.openstream","Undefined profiler 
mode option");
+       }
        maleventstream = cntxt->fdout;
        profilerUser = cntxt->user;
 
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
@@ -51,9 +51,10 @@ CMDopenProfilerStream(Client cntxt, MalB
        (void) stk;
        (void) pc;
        int m = 0;
-       if (getArgType(mb, pc, 1) == TYPE_int && (pc->argc == 1 || pc->argc == 
2)) {
+       if (pc->argc == 2 && getArgType(mb, pc, 1) == TYPE_int)
                m = *getArgReference_int(stk, pc, 1);
-       }
+       else if (pc->argc > 2)
+               m = -1;
        return openProfilerStream(cntxt, m);
 }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to