process

package
Version: v0.0.0-...-9649366 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package process provides functions for inspecting processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumFDs

func NumFDs(pid int) (int, error)

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

func NumFDsWithBatchSleep(pid int, batchDurationSleepMultiplier float64) (int, error)

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

func NumFDsWithDefaultBatchSleep(pid int) (int, error)

NumFDsWithDefaultBatchSleep is the same as NumFDsWithBatchSleep except it uses the default value for the batchSleepDurationMultiplier.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL