diff options
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/api.rst | 1 | ||||
-rw-r--r-- | docs/src/loop.rst | 5 | ||||
-rw-r--r-- | docs/src/metrics.rst | 25 |
3 files changed, 31 insertions, 0 deletions
diff --git a/docs/src/api.rst b/docs/src/api.rst index 22f0640f..c8e837dd 100644 --- a/docs/src/api.rst +++ b/docs/src/api.rst @@ -32,4 +32,5 @@ API documentation dll threading misc + metrics diff --git a/docs/src/loop.rst b/docs/src/loop.rst index d642ac1d..fc747c27 100644 --- a/docs/src/loop.rst +++ b/docs/src/loop.rst @@ -68,6 +68,11 @@ API to suppress unnecessary wakeups when using a sampling profiler. Requesting other signals will fail with UV_EINVAL. + - UV_METRICS_IDLE_TIME: Accumulate the amount of idle time the event loop + spends in the event provider. + + This option is necessary to use :c:func:`uv_metrics_idle_time`. + .. c:function:: int uv_loop_close(uv_loop_t* loop) Releases all internal loop resources. Call this function only when the loop diff --git a/docs/src/metrics.rst b/docs/src/metrics.rst new file mode 100644 index 00000000..223f7feb --- /dev/null +++ b/docs/src/metrics.rst @@ -0,0 +1,25 @@ + +.. _metrics: + +Metrics operations +====================== + +libuv provides a metrics API to track the amount of time the event loop has +spent idle in the kernel's event provider. + +API +--- + +.. c:function:: uint64_t uv_metrics_idle_time(uv_loop_t* loop) + + Retrieve the amount of time the event loop has been idle in the kernel's + event provider (e.g. ``epoll_wait``). The call is thread safe. + + The return value is the accumulated time spent idle in the kernel's event + provider starting from when the :c:type:`uv_loop_t` was configured to + collect the idle time. + + .. note:: + The event loop will not begin accumulating the event provider's idle + time until calling :c:type:`uv_loop_configure` with + :c:type:`UV_METRICS_IDLE_TIME`. |