Changeset: e6b11f038adc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e6b11f038adc Modified Files: monetdb5/mal/mal_profiler.c Branch: default Log Message:
make sure too only flush at end of event. diffs (77 lines): 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 @@ -60,7 +60,7 @@ static struct rusage prevUsage; #define LOGLEN 8192 // The heart beat events should be sent to all outstanding channels. -static void logjsonInternal(char *logbuffer) +static void logjsonInternal(char *logbuffer, bool flush) { size_t len; len = strlen(logbuffer); @@ -68,8 +68,8 @@ static void logjsonInternal(char *logbuf MT_lock_set(&mal_profileLock); if (maleventstream) { // upon request the log record is sent over the profile stream - if (mnstr_write(maleventstream, logbuffer, 1, len) != BLOCK) /* if we wrote exactly the BLOCK size, it was - flushed allready */ + (void) mnstr_write(maleventstream, logbuffer, 1, len); + if (flush) (void) mnstr_flush(maleventstream, MNSTR_FLUSH_DATA); } MT_lock_unset(&mal_profileLock); @@ -142,7 +142,7 @@ logadd(struct logbuf *logbuf, const char /* includes first time when logbuffer == NULL and logcap = 0 */ char *alloc_buff; if (logbuf->loglen > 0) - logjsonInternal(logbuf->logbuffer); + logjsonInternal(logbuf->logbuffer, false); logbuf->logcap = (size_t) tmp_len + (size_t) tmp_len/2; if (logbuf->logcap < LOGLEN) logbuf->logcap = LOGLEN; @@ -157,7 +157,7 @@ logadd(struct logbuf *logbuf, const char logbuf->logbuffer = alloc_buff; lognew(logbuf); } else { - logjsonInternal(logbuf->logbuffer); + logjsonInternal(logbuf->logbuffer, false); lognew(logbuf); } } @@ -477,7 +477,7 @@ renderProfilerEvent(Client cntxt, MalBlk str ev; ev = prepareProfilerEvent(cntxt, mb, stk, pci, start); if( ev ){ - logjsonInternal(ev); + logjsonInternal(ev, true); free(ev); } } @@ -615,7 +615,7 @@ profilerHeartbeatEvent(char *alter) "}\n", // end marker alter, cpuload)) return; - logjsonInternal(logbuf.logbuffer); + logjsonInternal(logbuf.logbuffer, true); logdel(&logbuf); } @@ -650,7 +650,7 @@ openProfilerStream(Client cntxt) #endif if (myname == 0){ myname = putName("profiler"); - logjsonInternal(monet_characteristics); + logjsonInternal(monet_characteristics, true); } if(maleventstream){ /* The DBA can always grab the stream, others have to wait */ @@ -720,7 +720,7 @@ startProfiler(Client cntxt) } malProfileMode = 1; MT_lock_unset(&mal_profileLock); - logjsonInternal(monet_characteristics); + logjsonInternal(monet_characteristics, true); // reset the trace table clearTrace(cntxt); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list