schedpolicy

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

schedpolicy

Call sched_getscheduler, sched_setscheduler.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PolicyStrings added in v0.2.0

func PolicyStrings() []string

PolicyStrings returns a slice of all String values of the enum

func Set

func Set(pid int, policy Policy, priority int) error

Set sets the scheduling policy and parameters for the process specified by pid.

Calls sched_setscheduler. https://man7.org/linux/man-pages/man2/sched_setscheduler.2.html

Types

type Policy

type Policy int

Policy is a scheduling policy.

const (
	Normal   Policy = 0
	FIFO     Policy = 1
	RR       Policy = 2
	Batch    Policy = 3
	Idle     Policy = 5
	Deadline Policy = 6
)

Possible values for sched_policy.

https://github.com/torvalds/linux/blob/d90b0276af8f25a0b8ae081a30d1b2a61263393b/include/uapi/linux/sched.h#L111-L120

func Get

func Get(pid int) (Policy, error)

Get gets the scheduling policy and parameters for the process specified by pid.

Calls sched_getscheduler. https://man7.org/linux/man-pages/man2/sched_setscheduler.2.html

func PolicyString added in v0.2.0

func PolicyString(s string) (Policy, error)

PolicyString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func PolicyValues added in v0.2.0

func PolicyValues() []Policy

PolicyValues returns all values of the enum

func (Policy) IsAPolicy added in v0.2.0

func (i Policy) IsAPolicy() bool

IsAPolicy returns "true" if the value is listed in the enum definition. "false" otherwise

func (Policy) MarshalText added in v0.2.0

func (i Policy) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Policy

func (Policy) String

func (i Policy) String() string

func (*Policy) UnmarshalText added in v0.2.0

func (i *Policy) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Policy

Jump to

Keyboard shortcuts

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