Changeset: a2aac598ae80 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a2aac598ae80 Modified Files: clients/mapiclient/eventparser.c clients/mapiclient/eventparser.h clients/mapiclient/tachograph.c monetdb5/mal/mal_profiler.c tools/mserver/mserver5.c Branch: default Log Message:
Stratify event processing. The system properties are sent using the default event structure where the function call is replaced by a key-value json structure. diffs (131 lines): diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c --- a/clients/mapiclient/eventparser.c +++ b/clients/mapiclient/eventparser.c @@ -17,7 +17,7 @@ int malargtop; char *malvariables[MAXMALARGS]; int malvartop; int debug; -char *monet_characteristics; +char *monetdb_characteristics; void clearArguments(void) @@ -107,8 +107,6 @@ eventparser(char *row, EventRecord *ev) /* check basic validaty first */ if (row[0] =='#'){ - if( row[1] =='{') - monet_characteristics = strdup(row+1); return 0; } if (row[0] != '[') @@ -264,6 +262,9 @@ eventparser(char *row, EventRecord *ev) ev->fcn = strdup(c); ev->stmt = strdup(ev->fcn); c= ev->fcn; + if( ev->state == MDB_SYSTEM){ + monetdb_characteristics = strdup(ev->stmt); + } else if( *c != '[') { c = strstr(c + 1, ":="); diff --git a/clients/mapiclient/eventparser.h b/clients/mapiclient/eventparser.h --- a/clients/mapiclient/eventparser.h +++ b/clients/mapiclient/eventparser.h @@ -94,7 +94,7 @@ extern int malargtop; extern char *malvariables[MAXMALARGS]; extern int malvartop; extern int debug; -extern char *monet_characteristics; +extern char *monetdb_characteristics; extern void clearArguments(void); extern int eventparser(char *row, EventRecord *ev); diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c --- a/clients/mapiclient/tachograph.c +++ b/clients/mapiclient/tachograph.c @@ -481,14 +481,13 @@ initFiles(void) fprintf(stderr,"Could not create %s\n",buf); exit(0); } - if( monet_characteristics) - fprintf(tachotrace,"%s\n",monet_characteristics); } static void progressBarInit(char *qry) { fprintf(tachojson,"{ \"tachograph\":0.1,\n"); + fprintf(tachojson," \"system\":%s,\n",monetdb_characteristics); fprintf(tachojson," \"qid\":\"%s\",\n",currentfunction?currentfunction:""); fprintf(tachojson," \"tag\":\"%d\",\n",currenttag); fprintf(tachojson," \"query\":\"%s\",\n",qry); @@ -930,7 +929,7 @@ main(int argc, char **argv) update(&event); if (debug ) fprintf(stderr, "PARSE %d:%s\n", i, response); - if( trace && i >=0 && capturing) + if( trace && i >=0 && (capturing || event.state == MDB_SYSTEM)) fprintf(trace,"%s\n",response); if( tachotrace && i >=0 && capturing) fprintf(tachotrace,"%s\n",response); 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 @@ -55,8 +55,6 @@ offlineProfilerHeader(void) if (eventstream == NULL) return ; - mnstr_printf(eventstream,"%s\n", monet_characteristics); - mnstr_flush(eventstream); lognew(); logadd("# "); @@ -94,15 +92,20 @@ offlineProfilerHeader(void) */ static void logsend(char *logbuffer) -{ int error=0; +{ int error=0; + int showsystem = 0; if (eventstream) { MT_lock_set(&mal_profileLock, "logsend"); - if( eventcounter == 0) + if( eventcounter == 0){ offlineProfilerHeader(); + showsystem++; + } eventcounter++; error= mnstr_printf(eventstream,"[ %d,\t%s", eventcounter, logbuffer); error= mnstr_flush(eventstream); MT_lock_unset(&mal_profileLock, "logsend"); + if( showsystem) + offlineProfilerEvent(0, 0, 0, 0, "system", monet_characteristics); if ( error) stopProfiler(); } } diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c --- a/tools/mserver/mserver5.c +++ b/tools/mserver/mserver5.c @@ -155,16 +155,18 @@ monet_hello(void) printf("# Visit http://www.monetdb.org/ for further information\n"); // The properties shipped through the performance profiler - len = snprintf(monet_characteristics, sizeof(monet_characteristics)-1, "#{ MonetDBversion:\"%s\", ", VERSION); + len = snprintf(monet_characteristics, sizeof(monet_characteristics)-1, "{ MonetDBversion:\"%s\", ", VERSION); len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "release:\"%s\", ", MONETDB_RELEASE); len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "host:\"%s\", ", HOST); len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "threads:\"%d\", ", GDKnr_threads); len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "memory:\"%.3f %cB\", ", sz_mem_h, qc[qi]); len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "oid:\""SZFMT"\", ", sizeof(oid) *8); + len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "packages:["); + // add the compiled in package names #ifdef HAVE_HGE - len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "huge:\"\""); + len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "\"%s\"","huge"); #endif - len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "}"); + len += snprintf(monet_characteristics + len, sizeof(monet_characteristics)-1-len, "]}"); } static str _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list