void VSL(enum shmlogtag tag, int id, const char *fmt, ...);
void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t);
void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...);
-void WSL_Flush(struct worker *w);
+void WSL_Flush(struct worker *w, int overflow);
#define WSP(sess, tag, fmt, ...) \
WSL((sess)->wrk, tag, (sess)->fd, fmt, __VA_ARGS__)
#define WSPR(sess, tag, txt) \
sp->t_open = sp->t_end;
sp->t_req = NAN;
sp->t_resp = NAN;
- WSL_Flush(sp->wrk);
+ WSL_Flush(sp->wrk, 0);
/* If we did an ESI include, don't mess up our state */
if (sp->esis > 0)
WSL(sp->wrk, SLT_Debug, sp->id,
"thr %p STP_%s sp %p obj %p vcl %p",
pthread_self(), state, sp, sp->obj, sp->vcl);
- WSL_Flush(sp->wrk);
+ WSL_Flush(sp->wrk, 0);
} else {
VSL(SLT_Debug, sp->id,
"thr %p STP_%s sp %p obj %p vcl %p",
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
}
assert(!isnan(w->used));
- WSL_Flush(w);
+ WSL_Flush(w, 0);
}
/*
CHECK_OBJ_ORNULL(oe, OBJEXP_MAGIC);
if (oe == NULL || oe->timer_when > t) { /* XXX: > or >= ? */
UNLOCK(&exp_mtx);
- WSL_Flush(&ww);
+ WSL_Flush(&ww, 0);
AZ(sleep(1));
VCL_Refresh(&sp->vcl);
t = TIM_real();
int fd;
int ttl = 0; /* XXX: ?? */
- WSL_Flush(sp->wrk);
+ WSL_Flush(sp->wrk, 0);
assert(status >= 100 && status <= 999);
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
/*--------------------------------------------------------------------*/
void
-WSL_Flush(struct worker *w)
+WSL_Flush(struct worker *w, int overflow)
{
unsigned char *p;
unsigned l;
if (l == 0)
return;
LOCKSHM(&vsl_mtx);
+ VSL_stats->shm_flushes += overflow;
VSL_stats->shm_writes++;
VSL_stats->shm_records += w->wlr;
if (loghead->ptr + l + 1 >= loghead->size)
/* Wrap if necessary */
if (w->wlp + SHMLOG_NEXTTAG + l + 1 >= w->wle)
- WSL_Flush(w);
+ WSL_Flush(w, 1);
p = w->wlp;
w->wlp += SHMLOG_NEXTTAG + l;
assert(w->wlp < w->wle);
/* Wrap if we cannot fit a full size record */
if (w->wlp + SHMLOG_NEXTTAG + 255 + 1 >= w->wle)
- WSL_Flush(w);
+ WSL_Flush(w, 1);
p = w->wlp;
n = vsnprintf((char *)(p + SHMLOG_DATA), 256, fmt, ap);
MAC_STAT(shm_records, uint64_t, 'a', "SHM records")
MAC_STAT(shm_writes, uint64_t, 'a', "SHM writes")
+MAC_STAT(shm_flushes, uint64_t, 'a', "SHM flushes due to overflow")
MAC_STAT(shm_cont, uint64_t, 'a', "SHM MTX contention")
MAC_STAT(sm_nreq, uint64_t, 'a', "allocator requests")