Changeset: 124e4e06ff1d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/124e4e06ff1d
Modified Files:
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_profiler.h
        sql/backends/monet5/sql.c
Branch: sql_profiler
Log Message:

Start emitting some genericEvents


diffs (91 lines):

diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -207,7 +207,12 @@ MCexitClient(Client c)
                c->fdout = NULL;
                c->fdin = NULL;
        }
-       // TODO PROFILER: EVENT("end of client connection", "client_id", 
TYPE_int, c->id)
+
+       genericEvent("End client connection.",
+                                (struct GenericEvent)
+                                { &c->idx, (oid)NULL, NULL, NULL, NULL },
+                                1);
+
        setClientContext(NULL);
 }
 
@@ -299,10 +304,13 @@ MCinitClient(oid user, bstream *fin, str
 
        MT_lock_set(&mal_contextLock);
        c = MCnewClient();
-       // TODO PROFILER: EVENT("start of client connection", "client_id", 
TYPE_int, c->id)
        if (c) {
                assert(NULL == setClientContext(c));
                c = MCinitClientRecord(c, user, fin, fout);
+               genericEvent("Start client connection.",
+                                        (struct GenericEvent)
+                                        { &c->idx, (oid)NULL, NULL, NULL, NULL 
},
+                                        0);
        }
        MT_lock_unset(&mal_contextLock);
        return c;
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
@@ -199,9 +199,9 @@ prepareGenericEvent(str msg, struct Gene
                           ",\"state\":\"%d\""
                           "}\n",
                           msg ? msg : "",
-                          0,
-                          (oid)0,
-                          e.transaction_id ? *e.transaction_id : 0,
+                          e.clientId ? *(e.clientId) : -1,
+                          e.tag ? e.tag : (oid)-1,
+                          e.transactionId ? *e.transactionId : 0,
                           e.query ? e.query : "",
                           e.error ? e.error : "",
                           state))
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
@@ -21,7 +21,9 @@ typedef struct rusage Rusage;
 #endif
 
 struct GenericEvent {
-       int* transaction_id;
+       int* clientId;
+       oid tag;
+       int* transactionId;
        str query;
        str error;
 };
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -127,17 +127,18 @@ sql_symbol2relation(backend *be, symbol 
        lng Tbegin;
        int value_based_opt = be->mvc->emode != m_prepare, storage_based_opt;
        int profile = be->mvc->emode == m_plan;
-
-       // TODO PROFILER: EVENT("start of SQL compiler", "program_id", 
TYPE_int, log c->curprg->def->tag)
-       genericEvent("SQL compiler",
-                                (struct GenericEvent){ 0, NULL, NULL},
+       Client c = getClientContext();
+
+       genericEvent("Start SQL compiler",
+                                (struct GenericEvent)
+                                { &(c->idx), c->curprg->def->tag, NULL, NULL, 
NULL },
                                 0);
 
        rel = rel_semantic(query, sym);
 
-       // TODO PROFILER: EVENT("end of SQL compiler;start of relational 
optimizer","program_id", TYPE_int, be->c->curprg->def->tag, "error", TYPE_int, 
rel == NULL)
-       genericEvent("SQL compiler",
-                                (struct GenericEvent){ 0, NULL, NULL},
+       genericEvent("End SQL compiler",
+                                (struct GenericEvent)
+                                { &(c->idx), c->curprg->def->tag, NULL, NULL, 
rel ? "Good" : "Error" },
                                 1);
 
        storage_based_opt = value_based_opt && rel && !is_ddl(rel->op);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to