proc

package
v0.0.0-...-1327151 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package proc implements process manipulation through syscalls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Affinity

func Affinity(pid int) ([]int, error)

Affinity returns the CPU affinity of the given process.

func AffinitySelf

func AffinitySelf() ([]int, error)

AffinitySelf returns the

func Exec

func Exec(args []string) error

Exec executes the given command using the execve(2) system call, inheriting environment.

func SetCPUSet

func SetCPUSet(pid int, name string) error

SetCPUSet moves pid to the named cpuset.

func SetCPUSetSelf

func SetCPUSetSelf(name string) error

SetCPUSetSelf moves this thread to the named cpuset.

func SetPriority

func SetPriority(pid, priority int) error

SetPriority sets the priority of process with the given pid, where 0 is the calling process.

func SetScheduler

func SetScheduler(pid int, policy Policy, param *SchedParam) error

SetScheduler sets the linux scheduling policy for process pid, where 0 is the calling process.

Types

type Policy

type Policy int

Policy is a linux scheduling policy.

const (
	SCHED_OTHER    Policy = 0
	SCHED_FIFO     Policy = 1
	SCHED_RR       Policy = 2
	SCHED_BATCH    Policy = 3
	SCHED_IDLE     Policy = 5
	SCHED_DEADLINE Policy = 6
)

Linux scheduling policies.

Reference: https://github.com/torvalds/linux/blob/ca7e1fd1026c5af6a533b4b5447e1d2f153e28f2/include/uapi/linux/sched.h#L106-L115

/*
 * Scheduling policies
 */
#define SCHED_NORMAL		0
#define SCHED_FIFO		1
#define SCHED_RR		2
#define SCHED_BATCH		3
/* SCHED_ISO: reserved but not implemented yet */
#define SCHED_IDLE		5
#define SCHED_DEADLINE		6

Reference: https://github.com/torvalds/linux/blob/c309b6f24222246c18a8b65d3950e6e755440865/Documentation/scheduler/sched-design-CFS.rst#L124-L125

  • SCHED_NORMAL (traditionally called SCHED_OTHER): The scheduling policy that is used for regular tasks.

func (Policy) String

func (p Policy) String() string

String represents the policy as one of the SCHED_* constants, if possible.

type SchedParam

type SchedParam struct {
	Priority int
}

SchedParam is the linux sched_param struct.

Reference: https://github.com/torvalds/linux/blob/0a115e5f23b948be369faf14d3bccab283830f56/include/uapi/linux/sched/types.h#L7-L9

struct sched_param {
	int sched_priority;
};

type Stat

type Stat struct{}

Stat is a config provider based on the `/proc/*/stat` file.

func (Stat) Available

func (Stat) Available() bool

Available checks for the /proc/self/stat file.

func (Stat) Configuration

func (Stat) Configuration() (cfg.Configuration, error)

Configuration reports performance-critical parameters from the /proc/self/stat file.

func (Stat) Doc

func (Stat) Doc() string

Doc for the configuration provider.

func (Stat) Key

func (Stat) Key() cfg.Key

Key returns "procstat".

Jump to

Keyboard shortcuts

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