$ echo $?
0
+
+Code reference
+==============
+
+.. doxygenfile:: daemon/worker.h
+
+
.. _`JSON-encoded`: http://json.org/example
.. _`Learn Lua in 15 minutes`: http://tylerneylon.com/a/learn-lua/
.. _`PowerDNS Recursor`: https://doc.powerdns.com/md/recursor/scripting/
return 0;
}
lua_newtable(L);
+ lua_pushnumber(L, worker->stats.queries);
+ lua_setfield(L, -2, "queries");
lua_pushnumber(L, worker->stats.concurrent);
lua_setfield(L, -2, "concurrent");
+ lua_pushnumber(L, worker->stats.dropped);
+ lua_setfield(L, -2, "dropped");
+
+ lua_pushnumber(L, worker->stats.timeout);
+ lua_setfield(L, -2, "timeout");
lua_pushnumber(L, worker->stats.udp);
lua_setfield(L, -2, "udp");
lua_pushnumber(L, worker->stats.tcp);
lua_setfield(L, -2, "tcp");
lua_pushnumber(L, worker->stats.tls);
lua_setfield(L, -2, "tls");
- lua_pushnumber(L, worker->stats.ipv6);
- lua_setfield(L, -2, "ipv6");
lua_pushnumber(L, worker->stats.ipv4);
lua_setfield(L, -2, "ipv4");
- lua_pushnumber(L, worker->stats.queries);
- lua_setfield(L, -2, "queries");
- lua_pushnumber(L, worker->stats.dropped);
- lua_setfield(L, -2, "dropped");
- lua_pushnumber(L, worker->stats.timeout);
- lua_setfield(L, -2, "timeout");
+ lua_pushnumber(L, worker->stats.ipv6);
+ lua_setfield(L, -2, "ipv6");
+
/* Add subset of rusage that represents counters. */
uv_rusage_t rusage;
if (uv_getrusage(&rusage) == 0) {
.. function:: worker.stats()
- Return table of statistics.
-
- * ``udp`` - number of outbound queries over UDP
- * ``tcp`` - number of outbound queries over TCP
- * ``ipv6`` - number of outbound queries over IPv6
- * ``ipv4`` - number of outbound queries over IPv4
- * ``timeout`` - number of timeouted outbound queries
- * ``concurrent`` - number of concurrent queries at the moment
- * ``queries`` - number of inbound queries
- * ``dropped`` - number of dropped inbound queries
+ Return table of statistics. See member descriptions in :c:type:`worker_stats`.
+ A few fields are added, mainly from POSIX ``getrusage()``:
+
+ * ``usertime`` and ``systime`` -- CPU time used, in seconds
+ * ``pagefaults`` -- the number of hard page faults, i.e. those that required I/O activity
+ * ``swaps`` -- the number of times the process was “swapped” out of main memory; unused on Linux
+ * ``csw`` -- the number of context switches, both voluntary and involuntary
+ * ``rss`` -- current memory usage in bytes, including whole cache (resident set size)
Example:
void worker_task_subreq_finalize(struct qr_task *task);
bool worker_task_finished(struct qr_task *task);
+
+/** Various worker statistics. Sync with wrk_stats() */
+struct worker_stats {
+ size_t queries; /**< Total number of requests (from clients and internal ones). */
+ size_t concurrent; /**< The number of requests currently in processing. */
+ size_t rconcurrent; /*< TODO: remove? I see no meaningful difference from .concurrent. */
+ size_t dropped; /**< The number of requests dropped due to being badly formed. See #471. */
+
+ size_t timeout; /**< Number of outbound queries that timed out. */
+ size_t udp; /**< Number of outbound queries over UDP. */
+ size_t tcp; /**< Number of outbound queries over TCP (excluding TLS). */
+ size_t tls; /**< Number of outbound queries over TLS. */
+ size_t ipv4; /**< Number of outbound queries over IPv4.*/
+ size_t ipv6; /**< Number of outbound queries over IPv6. */
+};
+
/** @cond internal */
/** Number of request within timeout window. */
uint8_t wire_buf[RECVMMSG_BATCH * KNOT_WIRE_MAX_PKTSIZE];
- struct {
- size_t concurrent;
- size_t rconcurrent;
- size_t udp;
- size_t tcp;
- size_t tls;
- size_t ipv4;
- size_t ipv6;
- size_t queries;
- size_t dropped;
- size_t timeout;
- } stats;
+ struct worker_stats stats;
struct zone_import_ctx* z_import;
bool too_many_open;
GENERATE_MAN = NO
GENERATE_RTF = NO
CASE_SENSE_NAMES = NO
-INPUT = ../lib
+INPUT = ../lib ../daemon
FILE_PATTERNS = *.h
QUIET = YES
RECURSIVE = YES