Changeset: 0606e493aa60 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0606e493aa60 Modified Files: monetdb5/mal/mal.h monetdb5/mal/mal_profiler.c monetdb5/mal/mal_runtime.c monetdb5/mal/mal_runtime.h monetdb5/modules/mal/sysmon.c Branch: Nov2019 Log Message:
Use oid for query tags. diffs (137 lines): diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -175,7 +175,7 @@ typedef struct { typedef struct MALBLK { char binding[IDLENGTH]; /* related C-function */ str help; /* supportive commentary */ - lng tag; /* unique block tag */ + oid tag; /* unique block tag */ struct MALBLK *alternative; int vtop; /* next free slot */ int vsize; /* size of variable arena */ @@ -229,7 +229,7 @@ typedef struct MALSTK { char cmd; /* debugger and runtime communication */ char status; /* srunning 'R' suspended 'S', quiting 'Q' */ int pcup; /* saved pc upon a recursive all */ - lng tag; /* unique invocation call tag */ + oid tag; /* unique invocation call tag */ struct MALSTK *up; /* stack trace list */ struct MALBLK *blk; /* associated definition */ ValRecord stk[FLEXIBLE_ARRAY_MEMBER]; 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 @@ -165,14 +165,14 @@ renderProfilerEvent(MalBlkPtr mb, MalStk logadd("\"function\":\"%s.%s\",%s", getModuleId(getInstrPtr(mb, 0)), getFunctionId(getInstrPtr(mb, 0)), prettify); logadd("\"pc\":%d,%s", mb?getPC(mb,pci):0, prettify); - logadd("\"tag\":"LLFMT",%s", stk?stk->tag:0, prettify); + logadd("\"tag\":"OIDFMT",%s", stk?stk->tag:0, prettify); logadd("\"module\":\"%s\",%s", pci->modname ? pci->modname : "", prettify); if (pci->modname && strcmp(pci->modname, "user") == 0) { - lng caller_tag = 0; + oid caller_tag = 0; if(stk && stk->up) { caller_tag = stk->up->tag; } - logadd("\"caller\":"LLFMT",%s", caller_tag, prettify); + logadd("\"caller\":"OIDFMT",%s", caller_tag, prettify); } logadd("\"instruction\":\"%s\",%s", pci->fcnname ? pci->fcnname : "", prettify); if (!GDKinmemory()) { @@ -904,9 +904,9 @@ cachedProfilerEvent(MalBlkPtr mb, MalStk return; /* update the Trace tables */ - snprintf(buf, BUFSIZ, "%s.%s[%d]"LLFMT, - getModuleId(getInstrPtr(mb, 0)), - getFunctionId(getInstrPtr(mb, 0)), getPC(mb, pci), stk->tag); + snprintf(buf, BUFSIZ, "%s.%s[%d]"OIDFMT, + getModuleId(getInstrPtr(mb, 0)), + getFunctionId(getInstrPtr(mb, 0)), getPC(mb, pci), stk->tag); /* generate actual call statement */ stmt = instruction2str(mb, stk, pci, LIST_MAL_ALL); diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c --- a/monetdb5/mal/mal_runtime.c +++ b/monetdb5/mal/mal_runtime.c @@ -29,7 +29,8 @@ // Keep a queue of running queries QueryQueue QRYqueue; lng qtop; -static lng qsize, qtag= 1; +static lng qsize; +static oid qtag= 1; #define QRYreset(I)\ if (QRYqueue[I].query) GDKfree(QRYqueue[I].query);\ diff --git a/monetdb5/mal/mal_runtime.h b/monetdb5/mal/mal_runtime.h --- a/monetdb5/mal/mal_runtime.h +++ b/monetdb5/mal/mal_runtime.h @@ -28,7 +28,7 @@ typedef struct QRYQUEUE{ Client cntxt; MalBlkPtr mb; MalStkPtr stk; - lng tag; + oid tag; str query; str status; time_t start; diff --git a/monetdb5/modules/mal/sysmon.c b/monetdb5/modules/mal/sysmon.c --- a/monetdb5/modules/mal/sysmon.c +++ b/monetdb5/modules/mal/sysmon.c @@ -66,7 +66,7 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, else // calculate progress based on past observations prog = (int) ((now- QRYqueue[i].start) / (QRYqueue[i].runtime/100.0)); - if (BUNappend(tag, &QRYqueue[i].tag, false) != GDK_SUCCEED) + if (BUNappend(tag, &(lng){QRYqueue[i].tag}, false) != GDK_SUCCEED) goto bailout; msg = AUTHgetUsername(&usr, QRYqueue[i].cntxt); if (msg != MAL_SUCCEED) @@ -152,10 +152,10 @@ SYSMONpause(Client cntxt, MalBlkPtr mb, } MT_lock_set(&mal_delayLock); for ( i = 0; QRYqueue[i].tag; i++) - if( QRYqueue[i].tag == tag && (QRYqueue[i].cntxt->user == cntxt->user || cntxt->user == MAL_ADMIN)){ - QRYqueue[i].stk->status = 'p'; - QRYqueue[i].status = "paused"; - } + if( (lng) QRYqueue[i].tag == tag && (QRYqueue[i].cntxt->user == cntxt->user || cntxt->user == MAL_ADMIN)){ + QRYqueue[i].stk->status = 'p'; + QRYqueue[i].status = "paused"; + } MT_lock_unset(&mal_delayLock); return MAL_SUCCEED; } @@ -182,10 +182,10 @@ SYSMONresume(Client cntxt, MalBlkPtr mb, } MT_lock_set(&mal_delayLock); for ( i = 0; QRYqueue[i].tag; i++) - if( QRYqueue[i].tag == tag && (QRYqueue[i].cntxt->user == cntxt->user || cntxt->user == MAL_ADMIN)){ - QRYqueue[i].stk->status = 0; - QRYqueue[i].status = "running"; - } + if( (lng)QRYqueue[i].tag == tag && (QRYqueue[i].cntxt->user == cntxt->user || cntxt->user == MAL_ADMIN)){ + QRYqueue[i].stk->status = 0; + QRYqueue[i].status = "running"; + } MT_lock_unset(&mal_delayLock); return MAL_SUCCEED; } @@ -212,10 +212,10 @@ SYSMONstop(Client cntxt, MalBlkPtr mb, M } MT_lock_set(&mal_delayLock); for ( i = 0; QRYqueue[i].tag; i++) - if( QRYqueue[i].tag == tag && (QRYqueue[i].cntxt->user == cntxt->user || cntxt->user == MAL_ADMIN)){ - QRYqueue[i].stk->status = 'q'; - QRYqueue[i].status = "stopping"; - } + if( (lng) QRYqueue[i].tag == tag && (QRYqueue[i].cntxt->user == cntxt->user || cntxt->user == MAL_ADMIN)){ + QRYqueue[i].stk->status = 'q'; + QRYqueue[i].status = "stopping"; + } MT_lock_unset(&mal_delayLock); return MAL_SUCCEED; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list