Skip to main contentModule fd_diagnostics
Source - FdTrackGuard
- RAII scope guard that records FD growth/cleanup over a code path.
Logs on creation/drop only when
fd-track is enabled.
- count_open_fds
- Returns the number of currently open file descriptors for this process.
- fds_since_baseline
- Returns the number of file descriptors opened since the last call to
set_fd_baseline. Negative values (FDs closed) are reported as 0. - list_open_fds
- Returns a snapshot of all currently open file descriptors and what they
point to (via readlink on Linux).
- print_new_fds
- Prints FDs present in
after but not in before. - report_fd_count
- Logs the current FD count snapshot with a label when
fd-track is enabled. - set_fd_baseline
- Sets the baseline FD count to the current value. Call this once at the start
of a test or process to establish a reference point.
- track_fd_scope