Changeset: 80f6525f8d82 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/80f6525f8d82
Modified Files:
        monetdb5/mal/mal_listing.c
Branch: mal_opt_output
Log Message:

Format explain optimizers section similar to rel plan opts section.


diffs (60 lines):

diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -273,6 +273,39 @@ fcnDefinition(MalBlkPtr mb, InstrPtr p, 
        return base;
 }
 
+static str
+fmtRemark(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, str t, int flg, str base, 
size_t len)
+{
+       int i;
+       char aux[64]; //no mal opt func name is bigger then this
+       str arg;
+
+       if (getFunctionId(pci)) {
+               snprintf(aux, 64, "%-39s", getFunctionId(pci));
+               if (!copystring(&t, aux, &len))
+                       return base;
+       }
+       for (i = pci->retc; i < pci->argc; i++) {
+               arg = renderTerm(mb, stk, pci, i, flg);
+               if (arg) {
+                       if (i == 1) {
+                               snprintf(aux, 64, "%d actions", atoi(arg));
+                       }
+                       else if (i == 2) {
+                               snprintf(aux, 64, "%ld usec", atol(arg));
+                       }
+                       if (!copystring(&t, aux, &len)) {
+                               GDKfree(arg);
+                               return base;
+                       }
+                       GDKfree(arg);
+               }
+               if (i < pci->argc -1 && !copystring(&t, " ", &len))
+                       return base;
+       }
+       return base;
+}
+
 str
 operatorName(int i)
 {
@@ -404,6 +437,7 @@ instruction2str(MalBlkPtr mb, MalStkPtr 
                }
                return fcnDefinition(mb, p, t, flg, base, len + (t - base));
        case REMsymbol:
+               return fmtRemark(mb, stk, p, t, flg, base, len);
        case NOOPsymbol:
                if (!copystring(&t, "#", &len))
                        return base;
@@ -436,7 +470,7 @@ instruction2str(MalBlkPtr mb, MalStkPtr 
                        return base;
        }
        for (i = p->retc; i < p->argc; i++) {
-               arg= renderTerm(mb, stk, p, i, flg);
+               arg = renderTerm(mb, stk, p, i, flg);
                if (arg) {
                        if (!copystring(&t, arg, &len)) {
                                GDKfree(arg);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to