Analyzer epoll-wait-ret-distr

Name

epoll-wait-ret-distr - Return Value Distribution of epoll_wait

This analyzer profiles the distribution of return values from epoll_wait and epoll_pwait system calls. It captures the number of ready file descriptors returned by each call, where 0 indicates a timeout and positive values indicate the number of ready events. The distribution reveals event loop efficiency: frequent zeros suggest excessive timeouts or idle periods, while consistently low positive values may indicate suboptimal batching. High return values show good event batching. This helps diagnose performance issues in event-driven applications and optimize polling strategies.

Resource Category

CPU.

Application Type & Technical Stack

  • All

Command Line Syntax

The analyzer can be invoked directly on the command-line via the orxray utility from the openresty-xray-cli software package.

Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).

# PID is the target process PID.
orxray analyzer run epoll-wait-ret-distr -p PID

# trace a shell command directly
orxray analyzer run epoll-wait-ret-distr -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run epoll-wait-ret-distr -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run epoll-wait-ret-distr --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Plain Texts

Output Example

[{
  "title": "Epoll Wait Return Values Distribution",
  "subtitle": "394 Calls in 2 secs (min: 0, avg: 0, max: 2)",
  "type": "dist-bar",
  "ver": 1,
  "series": {
    "data": {"0": 20, "1": 357, "2": 17, "4": 0, "8": 0},
    "categoryTitle": "Calls",
    "categoryUnit": "Calls",
    "name": "Calls"
  },
  "kind": "Epoll Wait Return Values"
}]

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.