BBlack has uploaded a new change for review.
https://gerrit.wikimedia.org/r/79076
Change subject: add queue_size and queue_max_size stats output
......................................................................
add queue_size and queue_max_size stats output
Change-Id: I9b58e53db97b0254323331f0f921426b88d85ccd
---
M src/stats.c
M src/stats.h
M src/strq.c
3 files changed, 20 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/software/varnish/vhtcpd
refs/changes/76/79076/1
diff --git a/src/stats.c b/src/stats.c
index f13d6f9..f30ad63 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -44,14 +44,18 @@
" inpkts_sane: %" PRIu64
" inpkts_enqueued: %" PRIu64
" inpkts_dequeued: %" PRIu64
- " queue_overflows: %" PRIu64,
+ " queue_overflows: %" PRIu64
+ " queue_size: %" PRIu64
+ " queue_max_size: %" PRIu64,
(uint64_t)start_time,
(uint64_t)(now - start_time),
stats.inpkts_recvd,
stats.inpkts_sane,
stats.inpkts_enqueued,
stats.inpkts_dequeued,
- stats.queue_overflows
+ stats.queue_overflows,
+ stats.queue_size,
+ stats.queue_max_size
);
}
@@ -69,6 +73,8 @@
" inpkts_enqueued:%" PRIu64
" inpkts_dequeued:%" PRIu64
" queue_overflows:%" PRIu64
+ " queue_size:%" PRIu64
+ " queue_max_size:%" PRIu64
"\n",
(uint64_t)start_time,
(uint64_t)(now - start_time),
@@ -76,7 +82,9 @@
stats.inpkts_sane,
stats.inpkts_enqueued,
stats.inpkts_dequeued,
- stats.queue_overflows
+ stats.queue_overflows,
+ stats.queue_size,
+ stats.queue_max_size
);
if(fpf_rv < 0) {
dmn_log_err("Failed to write data to stats tmpfile '%s': %s",
outfn_tmp, dmn_logf_errno());
diff --git a/src/stats.h b/src/stats.h
index 30c5b82..108b299 100644
--- a/src/stats.h
+++ b/src/stats.h
@@ -11,6 +11,8 @@
uint64_t inpkts_enqueued;
uint64_t inpkts_dequeued;
uint64_t queue_overflows;
+ uint64_t queue_size;
+ uint64_t queue_max_size;
} stats_t;
extern stats_t stats;
diff --git a/src/strq.c b/src/strq.c
index c22565b..bc2714d 100644
--- a/src/strq.c
+++ b/src/strq.c
@@ -57,7 +57,6 @@
unsigned q_tail; // always mod q_alloc
unsigned q_alloc; // allocation size of "queue" above
unsigned q_size; // used from allocation, always < q_alloc
- unsigned q_maxsize; // peak value of the above over time...
// Virtual heads for multiple dequeuers operating in parallel
// Note that at least one head always matches the true head, and
@@ -173,6 +172,7 @@
q->q_head++;
q->q_head &= (q->q_alloc - 1U); // mod po2 to wrap
q->q_size--;
+ stats.queue_size--;
if(!q->q_size) {
// if this was the last entry remaining, it's an easy
optimization
// to go ahead and reset the string head/tails back to zero
to
@@ -265,6 +265,8 @@
stats.queue_overflows++;
q->q_size = q->q_head = q->q_tail = 0;
q->str_head = q->str_tail = 0;
+ stats.queue_size = 0;
+ stats.queue_max_size = 0;
memset(q->vheads, 0, q->num_vheads * sizeof(unsigned));
assert_queue_sane(q);
}
@@ -285,6 +287,7 @@
// but the upside is q_head != q_tail unless the queue is empty,
// which makes other logic simpler with the virtual heads...
q->q_size++;
+ stats.queue_size++;
if(q->q_size == q->q_alloc) {
if(q->str_alloc + ((q->q_alloc << 1) * sizeof(qentry_t)) > q->max_mem)
return wipe_queue(q);
@@ -307,9 +310,9 @@
q->vheads[i] += old_alloc;
}
- // queue sizing and peak-tracking
- if(q->q_size > q->q_maxsize)
- q->q_maxsize = q->q_size;
+ // peak-tracking
+ if(q->q_size > stats.queue_max_size)
+ stats.queue_max_size = q->q_size;
// update tail pointer
qentry_t* qe = &q->queue[q->q_tail];
--
To view, visit https://gerrit.wikimedia.org/r/79076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b58e53db97b0254323331f0f921426b88d85ccd
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/varnish/vhtcpd
Gerrit-Branch: master
Gerrit-Owner: BBlack <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits