Changeset: 03a92e08d8a7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=03a92e08d8a7 Modified Files: clients/mapiclient/mclient.1 clients/mapiclient/mclient.c clients/mapilib/mapi.c clients/mapilib/mapi.h monetdb5/mal/mal_client.c monetdb5/mal/mal_client.h monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_profiler.c monetdb5/mal/mal_resource.c monetdb5/mal/mal_scenario.c sql/benchmarks/nobench/Tests/nobench.sql sql/benchmarks/nobench/Tests/nobench.stable.err sql/benchmarks/nobench/Tests/nobench.stable.out Branch: profiler Log Message:
Sync the code diffs (truncated from 567 to 300 lines): diff --git a/clients/mapiclient/mclient.1 b/clients/mapiclient/mclient.1 --- a/clients/mapiclient/mclient.1 +++ b/clients/mapiclient/mclient.1 @@ -17,7 +17,7 @@ mclient \- the MonetDB command-line tool MonetDB is a database management system that is developed from a main-memory perspective with use of a fully decomposed storage model, automatic index management, extensibility of data types and search -accelerators, SQL- and JAQL- frontends. +accelerators, and a SQL frontend. .PP .I Mclient is the command-line interface to the MonetDB server. diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -70,7 +70,7 @@ enum modes { MAL, SQL, - JAQL + PROFILER }; static enum modes mode = SQL; @@ -2109,6 +2109,8 @@ doFileBulk(Mapi mid, FILE *fp) static void showCommands(void) { + if (mode == PROFILER) + return; /* shared control options */ mnstr_printf(toConsole, "\\? - show this message\n"); if (mode == MAL) @@ -2968,7 +2970,7 @@ usage(const char *prog, int xit) fprintf(stderr, " -f kind | --format=kind specify output format {csv,tab,raw,sql,xml}\n"); fprintf(stderr, " -H | --history load/save cmdline history (default off)\n"); fprintf(stderr, " -i | --interactive[=tm] interpret `\\' commands on stdin, use time formatting {ms,s,m}\n"); - fprintf(stderr, " -l language | --language=lang {sql,mal}\n"); + fprintf(stderr, " -l language | --language=lang {sql,mal,profiler}\n"); fprintf(stderr, " -L logfile | --log=logfile save client/server interaction\n"); fprintf(stderr, " -s stmt | --statement=stmt run single statement\n"); fprintf(stderr, " -X | --Xdebug trace mapi network interaction\n"); @@ -3076,8 +3078,6 @@ main(int argc, char **argv) mode = SQL; } else if (strcmp(language, "mal") == 0) { mode = MAL; - } else if (strcmp(language, "jaql") == 0) { - mode = JAQL; } } else { language = strdup("sql"); @@ -3133,19 +3133,16 @@ main(int argc, char **argv) free(language); language = strdup("mal"); mode = MAL; - } else if (strcmp(optarg, "jaql") == 0 || - strcmp(optarg, "jaq") == 0 || - strcmp(optarg, "ja") == 0 || - strcmp(optarg, "j") == 0) { - free(language); - language = strdup("jaql"); - mode = JAQL; } else if (strcmp(optarg, "msql") == 0) { free(language); language = strdup("msql"); mode = MAL; + } else if (strcmp(optarg, "profiler") == 0) { + free(language); + language = strdup("profiler"); + mode = MAL; } else { - fprintf(stderr, "language option needs to be sql or mal\n"); + fprintf(stderr, "language option needs to be sql, mal, or profiler\n"); exit(-1); } break; @@ -3344,8 +3341,6 @@ main(int argc, char **argv) } else { if (mode == SQL) { setFormatter("sql"); - } else if (mode == JAQL) { - setFormatter("jaql"); } else { setFormatter("raw"); } @@ -3356,8 +3351,6 @@ main(int argc, char **argv) if (mode == SQL) { lang = "/SQL"; - } else if (mode == JAQL) { - lang = "/JAQL"; } else { lang = ""; } diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1467,10 +1467,6 @@ mapi_ping(Mapi mid) break; case LANG_MAL: hdl = mapi_query(mid, "io.print(1);"); - break; - case LANG_JAQL: - hdl = mapi_query(mid, "[1];"); - break; } if (hdl) mapi_close_handle(hdl); @@ -2013,8 +2009,8 @@ mapi_mapiuri(const char *url, const char mid->languageId = LANG_MAL; else if (strstr(lang, "sql") == lang) mid->languageId = LANG_SQL; - else if (strstr(lang, "jaql") == lang) - mid->languageId = LANG_JAQL; + else if (strstr(lang, "profiler") == lang) + mid->languageId = LANG_PROFILER; if (mid->database) free(mid->database); mid->database = NULL; @@ -2223,8 +2219,8 @@ mapi_mapi(const char *host, int port, co mid->languageId = LANG_MAL; else if (strstr(lang, "sql") == lang) mid->languageId = LANG_SQL; - else if (strstr(lang, "jaql") == lang) - mid->languageId = LANG_JAQL; + else if (strstr(lang, "profiler") == lang) + mid->languageId = LANG_PROFILER; if (mid->database) free(mid->database); @@ -2306,8 +2302,8 @@ parse_uri_query(Mapi mid, char *uri) mid->languageId = LANG_MAL; else if (strstr(val, "sql") == val) mid->languageId = LANG_SQL; - else if (strstr(val, "jaql") == val) - mid->languageId = LANG_JAQL; + else if (strstr(val, "profiler") == val) + mid->languageId = LANG_PROFILER; } else if (strcmp("user", uri) == 0) { /* until we figure out how this can be done safely wrt security, ignore */ @@ -3293,8 +3289,6 @@ mapi_param_store(MapiHdl hdl) checkSpace(5); if (hdl->mid->languageId == LANG_MAL) nullstr = "nil"; - else if (hdl->mid->languageId == LANG_JAQL) - nullstr = "null"; strcpy(hdl->query + k, nullstr); } else { void *src = hdl->params[i].inparam; /* abbrev */ diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h --- a/clients/mapilib/mapi.h +++ b/clients/mapilib/mapi.h @@ -50,7 +50,7 @@ typedef int MapiMsg; #define LANG_MAL 0 #define LANG_SQL 2 -#define LANG_JAQL 3 +#define LANG_PROFILER 3 /* prompts for MAPI protocol */ #define PROMPTBEG '\001' /* start prompt bracket */ 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 @@ -568,3 +568,18 @@ MCreadClient(Client c) #endif return 1; } + +str +PROFinitClient(Client c){ + startProfiler(c->idx,0,0); + return MAL_SUCCEED; +} + +str +PROFexitClient(Client c){ + (void) c; + stopProfiler(); + return MAL_SUCCEED; +} + + diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h --- a/monetdb5/mal/mal_client.h +++ b/monetdb5/mal/mal_client.h @@ -196,4 +196,6 @@ mal_export str MCsuspendClient(int i mal_export str MCawakeClient(int id); mal_export int MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt); +mal_export str PROFinitClient(Client c); +mal_export str PROFexitClient(Client c); #endif /* _MAL_CLIENT_H_ */ diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c --- a/monetdb5/mal/mal_dataflow.c +++ b/monetdb5/mal/mal_dataflow.c @@ -47,6 +47,7 @@ typedef struct FLOWEVENT { sht cost; lng hotclaim; /* memory foot print of result variables */ lng argclaim; /* memory foot print of arguments */ + lng maxclaim; /* memory foot print of largest argument, counld be used to indicate result size */ } *FlowEvent, FlowEventRec; typedef struct queue { @@ -367,6 +368,7 @@ DFLOWworker(void *T) #ifdef USE_MAL_ADMISSION if (MALadmission(fe->argclaim, fe->hotclaim)) { fe->hotclaim = 0; /* don't assume priority anymore */ + fe->maxclaim = 0; if (todo->last == 0) MT_sleep_ms(DELAYUNIT); q_requeue(todo, fe); @@ -374,8 +376,8 @@ DFLOWworker(void *T) } #endif error = runMALsequence(flow->cntxt, flow->mb, fe->pc, fe->pc + 1, flow->stk, 0, 0); - PARDEBUG fprintf(stderr, "#executed pc= %d wrk= %d claim= " LLFMT "," LLFMT " %s\n", - fe->pc, id, fe->argclaim, fe->hotclaim, error ? error : ""); + PARDEBUG fprintf(stderr, "#executed pc= %d wrk= %d claim= " LLFMT "," LLFMT "," LLFMT " %s\n", + fe->pc, id, fe->argclaim, fe->hotclaim, fe->maxclaim, error ? error : ""); #ifdef USE_MAL_ADMISSION /* release the memory claim */ MALadmission(-fe->argclaim, -fe->hotclaim); @@ -407,13 +409,19 @@ DFLOWworker(void *T) * All eligible instructions are queued */ #ifdef USE_MAL_ADMISSION - { + { InstrPtr p = getInstrPtr(flow->mb, fe->pc); assert(p); fe->hotclaim = 0; - for (i = 0; i < p->retc; i++) - fe->hotclaim += getMemoryClaim(flow->mb, flow->stk, p, i, FALSE); + fe->maxclaim = 0; + + for (i = 0; i < p->retc; i++){ + lng footprint; + footprint = getMemoryClaim(flow->mb, flow->stk, p, i, FALSE); + fe->hotclaim += footprint; + if( footprint > fe->maxclaim) fe->maxclaim = footprint; } + } #endif MT_lock_set(&flow->flowlock, "DFLOWworker"); @@ -424,6 +432,8 @@ DFLOWworker(void *T) flow->status[i].blocks = 0; flow->status[i].hotclaim = fe->hotclaim; flow->status[i].argclaim += fe->hotclaim; + if( flow->status[i].maxclaim < fe->maxclaim) + flow->status[i].maxclaim = fe->maxclaim; fnxt = flow->status + i; break; } 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 @@ -559,6 +559,8 @@ profilerEvent(oid usr, MalBlkPtr mb, Mal str openProfilerStream(stream *fd) { + if( eventstream) + closeProfilerStream(); malProfileMode = -1; eventstream = fd; return MAL_SUCCEED; diff --git a/monetdb5/mal/mal_resource.c b/monetdb5/mal/mal_resource.c --- a/monetdb5/mal/mal_resource.c +++ b/monetdb5/mal/mal_resource.c @@ -203,8 +203,8 @@ MALresourceFairness(lng usec) delay = (unsigned int) ( ((double)DELAYUNIT * running) / threads); if (delay) { if ( delayed++ == 0){ - mnstr_printf(GDKstdout, "#delay initial %u["LLFMT"] memory "SZFMT"[%f]\n", delay, clk, rss, MEMORY_THRESHOLD ); - mnstr_flush(GDKstdout); + PARDEBUG mnstr_printf(GDKstdout, "#delay initial %u["LLFMT"] memory "SZFMT"[%f]\n", delay, clk, rss, MEMORY_THRESHOLD ); + PARDEBUG mnstr_flush(GDKstdout); } MT_sleep_ms(delay); rss = GDKmem_cursize(); diff --git a/monetdb5/mal/mal_scenario.c b/monetdb5/mal/mal_scenario.c --- a/monetdb5/mal/mal_scenario.c +++ b/monetdb5/mal/mal_scenario.c @@ -16,8 +16,7 @@ * @emph{tactic scheduler} and @emph{engine}. These hooks allow * for both linked-in and external components. * - * The languages supported are SQL - * and the Monet Assembly Language (MAL). + * The languages supported are SQL, the Monet Assembly Language (MAL), and profiler. * The default scenario handles MAL instructions, which is used * to illustrate the behavior of the scenario steps. * @@ -100,6 +99,7 @@ #include "mal_client.h" #include "mal_authorize.h" #include "mal_exception.h" +#include "mal_profiler.h" _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list