Documentation ¶
Overview ¶
Package process provides functions for inspecting processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NumFDs ¶
NumFDs returns the number of file descriptors for a given process. This is an optimized implementation that avoids allocations as much as possible. In terms of wall-clock time it is not much faster than NumFDsReference due to the fact that the syscall overhead dominates, however, it produces significantly less garbage.
func NumFDsWithBatchSleep ¶ added in v0.9.2
NumFDsWithBatchSleep is the same as NumFDs but it throttles itself to prevent excessive CPU usages for processes with a lot of file descriptors.
batchDurationSleepMultiplier is the multiplier by which the amount of time spent performing a single batch of syscalls will be multiplied by to determine the amount of time that the function will spend sleeping.
For example, if performing syscallBatchSize syscalls takes 500 nanoseconds and batchDurationSleepMultiplier is 10 then the function will sleep for ~500 * 10 nanoseconds inbetween batches.
In other words, a batchDurationSleepMultiplier will cause the function to take approximately 10x longer but require 10x less CPU utilization at any given moment in time.
func NumFDsWithDefaultBatchSleep ¶ added in v0.9.2
NumFDsWithDefaultBatchSleep is the same as NumFDsWithBatchSleep except it uses the default value for the batchSleepDurationMultiplier.
Types ¶
This section is empty.