Changeset: ede15a1afca4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ede15a1afca4
Modified Files:
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_profiler.h
        sql/backends/monet5/sql_scenario.c
        sql/server/sql_mvc.c
        sql/storage/sql_storage.h
Branch: sql_profiler
Log Message:

Cleanup generic_events. Remove clientid from transaction event(no pair).


diffs (121 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
@@ -309,8 +309,7 @@ MCinitClient(oid user, bstream *fin, str
                c = MCinitClientRecord(c, user, fin, fout);
                if(malProfileMode > 0)
                        generic_event("client_connection",
-                                                (struct GenericEvent)
-                                                { &c->idx, NULL, NULL, NULL, 0 
},
+                                                (struct GenericEvent) { 
&c->idx, NULL, NULL, NULL, 0 },
                                                 0);
        }
        MT_lock_unset(&mal_contextLock);
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
@@ -198,23 +198,23 @@ prepare_generic_event(str face, struct G
                           ",\"thread\":%d"
                           ",\"face\":\"%s\""
                           ",\"state\":\"%s\""
-                          ",\"client_id\":\"%d\""
+                          ",\"client\":\"%d\""
                           ",\"transaction_id\":"ULLFMT
                           ",\"tag\":"OIDFMT
                           ",\"query\":\"%s\""
-                          ",\"rc\":\"%s\""
+                          ",\"rc\":\"%d\""
                           "}\n",
                           mercurial_revision(),
                           clk,
                           mclk,
                           THRgettid(),
                           face,
-                          state? "done" : "start",
-                          (e.client_id)? *(e.client_id) : 0,
-                          (e.transaction_id)? *(e.transaction_id) : 0,
-                          (e.tag)? *(e.tag) : 0,
-                          (e.query)? e.query : "none",
-                          (e.rc)? "false" : "true"))
+                          state ? "done" : "start",
+                          e.cid ? *e.cid : 0,
+                          e.tid ? *e.tid : 0,
+                          e.tag ? *e.tag : 0,
+                          e.query ? e.query : "none",
+                          e.rc))
                return logbuf.logbuffer;
        else {
                logdel(&logbuf);
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,11 +21,11 @@ typedef struct rusage Rusage;
 #endif
 
 struct GenericEvent {
-       int* client_id;
+       int* cid;  /* client_id */
        oid* tag;
-       ulng* transaction_id;
+       ulng* tid; /* transaction_id */
        str query;
-       int rc;               /* return code */
+       int rc;    /* return code */
 };
 
 mal_export int malProfileMode;
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1147,7 +1147,7 @@ SQLparser(Client c)
                str escaped_query = c->query? mal_quote(c->query, 
sizeof(c->query)) : NULL;
                generic_event("sql_parse",
                                         (struct GenericEvent)
-                                        { &c->idx, &(c->curprg->def->tag), 
NULL, escaped_query, c->query? 0 : 1, },
+                                        { &c->idx, &(c->curprg->def->tag), 
NULL, escaped_query, c->query? 0 : 1 },
                                         1);
                GDKfree(escaped_query);
        }
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -125,14 +125,12 @@ mvc_fix_depend(mvc *m, sql_column *depid
 }
 
 static void
-generic_event_wrapper(str face, ulng transaction_id, int rc, int state)
+generic_event_wrapper(str face, ulng tid, int rc, int state)
 {
-       int client_id = 0;
-
        if(malProfileMode > 0)
                generic_event(face,
                                          (struct GenericEvent)
-                                         { &client_id, NULL, &transaction_id, 
NULL, rc },
+                                         { NULL, NULL, &tid, NULL, rc },
                                          state);
 }
 
@@ -491,7 +489,7 @@ mvc_trans(mvc *m)
        if(malProfileMode > 0)
                generic_event("transaction",
                                         (struct GenericEvent)
-                                         { &(m->clientid), NULL, 
&(m->session->tr->tid), NULL, (res || err)? 1 : 0 },
+                                         { NULL, NULL, &(m->session->tr->tid), 
NULL, (res || err)? 1 : 0 },
                                          0);
 
        if (m->qc && (res || err)) {
diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h
--- a/sql/storage/sql_storage.h
+++ b/sql/storage/sql_storage.h
@@ -331,9 +331,7 @@ extern res_table *res_tables_remove(res_
 sql_export void res_tables_destroy(res_table *results);
 extern res_table *res_tables_find(res_table *results, int res_id);
 
-/* callback to access generic_event in store.c */
-typedef void (*generic_event_wrapper_fptr) (str face, ulng transaction_id, int 
rc, int state);
-
+typedef void (*generic_event_wrapper_fptr) (str face, ulng tid, int rc, int 
state);
 extern struct sqlstore *store_init(int debug, store_type store, int readonly, 
int singleuser, generic_event_wrapper_fptr event_wrapper);
 extern void store_exit(struct sqlstore *store);
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to