Commit dfc236e1 authored by Petr Špaček's avatar Petr Špaček

Merge branch 'docs-fixes' into 'master'

docs fixes

See merge request !814
parents c9ec19aa de2e9eca
...@@ -648,10 +648,17 @@ Example: ...@@ -648,10 +648,17 @@ Example:
$ echo $? $ echo $?
0 0
Code reference
==============
.. doxygenfile:: daemon/worker.h
.. _`JSON-encoded`: http://json.org/example .. _`JSON-encoded`: http://json.org/example
.. _`Learn Lua in 15 minutes`: http://tylerneylon.com/a/learn-lua/ .. _`Learn Lua in 15 minutes`: http://tylerneylon.com/a/learn-lua/
.. _`PowerDNS Recursor`: https://doc.powerdns.com/md/recursor/scripting/ .. _`PowerDNS Recursor`: https://doc.powerdns.com/md/recursor/scripting/
.. _LuaRocks: https://rocks.moonscript.org/ .. _LuaRocks: https://luarocks.org/
.. _libuv: https://github.com/libuv/libuv .. _libuv: https://github.com/libuv/libuv
.. _Lua: https://www.lua.org/about.html .. _Lua: https://www.lua.org/about.html
.. _LuaJIT: http://luajit.org/luajit.html .. _LuaJIT: http://luajit.org/luajit.html
......
...@@ -56,7 +56,7 @@ daemons or manipulated from other processes, making for example synchronized loa ...@@ -56,7 +56,7 @@ daemons or manipulated from other processes, making for example synchronized loa
.. code-block:: lua .. code-block:: lua
print(cache.storage) print(cache.current_storage)
.. function:: cache.backends() .. function:: cache.backends()
......
...@@ -127,24 +127,26 @@ static int wrk_stats(lua_State *L) ...@@ -127,24 +127,26 @@ static int wrk_stats(lua_State *L)
return 0; return 0;
} }
lua_newtable(L); lua_newtable(L);
lua_pushnumber(L, worker->stats.queries);
lua_setfield(L, -2, "queries");
lua_pushnumber(L, worker->stats.concurrent); lua_pushnumber(L, worker->stats.concurrent);
lua_setfield(L, -2, "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_pushnumber(L, worker->stats.udp);
lua_setfield(L, -2, "udp"); lua_setfield(L, -2, "udp");
lua_pushnumber(L, worker->stats.tcp); lua_pushnumber(L, worker->stats.tcp);
lua_setfield(L, -2, "tcp"); lua_setfield(L, -2, "tcp");
lua_pushnumber(L, worker->stats.tls); lua_pushnumber(L, worker->stats.tls);
lua_setfield(L, -2, "tls"); lua_setfield(L, -2, "tls");
lua_pushnumber(L, worker->stats.ipv6);
lua_setfield(L, -2, "ipv6");
lua_pushnumber(L, worker->stats.ipv4); lua_pushnumber(L, worker->stats.ipv4);
lua_setfield(L, -2, "ipv4"); lua_setfield(L, -2, "ipv4");
lua_pushnumber(L, worker->stats.queries); lua_pushnumber(L, worker->stats.ipv6);
lua_setfield(L, -2, "queries"); lua_setfield(L, -2, "ipv6");
lua_pushnumber(L, worker->stats.dropped);
lua_setfield(L, -2, "dropped");
lua_pushnumber(L, worker->stats.timeout);
lua_setfield(L, -2, "timeout");
/* Add subset of rusage that represents counters. */ /* Add subset of rusage that represents counters. */
uv_rusage_t rusage; uv_rusage_t rusage;
if (uv_getrusage(&rusage) == 0) { if (uv_getrusage(&rusage) == 0) {
......
...@@ -22,16 +22,14 @@ specified worker count and process rank. ...@@ -22,16 +22,14 @@ specified worker count and process rank.
.. function:: worker.stats() .. function:: worker.stats()
Return table of statistics. Return table of statistics. See member descriptions in :c:type:`worker_stats`.
A few fields are added, mainly from POSIX ``getrusage()``:
* ``udp`` - number of outbound queries over UDP
* ``tcp`` - number of outbound queries over TCP * ``usertime`` and ``systime`` -- CPU time used, in seconds
* ``ipv6`` - number of outbound queries over IPv6 * ``pagefaults`` -- the number of hard page faults, i.e. those that required I/O activity
* ``ipv4`` - number of outbound queries over IPv4 * ``swaps`` -- the number of times the process was “swapped” out of main memory; unused on Linux
* ``timeout`` - number of timeouted outbound queries * ``csw`` -- the number of context switches, both voluntary and involuntary
* ``concurrent`` - number of concurrent queries at the moment * ``rss`` -- current memory usage in bytes, including whole cache (resident set size)
* ``queries`` - number of inbound queries
* ``dropped`` - number of dropped inbound queries
Example: Example:
......
...@@ -107,6 +107,22 @@ uint64_t worker_task_creation_time(struct qr_task *task); ...@@ -107,6 +107,22 @@ uint64_t worker_task_creation_time(struct qr_task *task);
void worker_task_subreq_finalize(struct qr_task *task); void worker_task_subreq_finalize(struct qr_task *task);
bool worker_task_finished(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 */ /** @cond internal */
/** Number of request within timeout window. */ /** Number of request within timeout window. */
...@@ -140,18 +156,7 @@ struct worker_ctx { ...@@ -140,18 +156,7 @@ struct worker_ctx {
uint8_t wire_buf[RECVMMSG_BATCH * KNOT_WIRE_MAX_PKTSIZE]; uint8_t wire_buf[RECVMMSG_BATCH * KNOT_WIRE_MAX_PKTSIZE];
struct { struct worker_stats stats;
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 zone_import_ctx* z_import; struct zone_import_ctx* z_import;
bool too_many_open; bool too_many_open;
......
...@@ -5,7 +5,7 @@ GENERATE_LATEX = NO ...@@ -5,7 +5,7 @@ GENERATE_LATEX = NO
GENERATE_MAN = NO GENERATE_MAN = NO
GENERATE_RTF = NO GENERATE_RTF = NO
CASE_SENSE_NAMES = NO CASE_SENSE_NAMES = NO
INPUT = ../lib INPUT = ../lib ../daemon
FILE_PATTERNS = *.h FILE_PATTERNS = *.h
QUIET = YES QUIET = YES
RECURSIVE = YES RECURSIVE = YES
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment