<commit_before>// Package sched contains functions for set/get process scheduling parameters
package sched

import (
	"syscall"
	"unsafe"
)

type Policy uintptr

const (
	Other Policy = 0
	FIFO  Policy = 1
	RR    Policy = 2
	Batch Policy = 3
	Idle  Policy = 5
)

func (p Policy) String() string {
	switch p {
	case Other:
		return "Other"
	case FIFO:
		return "FIFO"
	case RR:
		return "RR"
	case Batch:
		return "Batch"
	case Idle:
		return "Idle"
	}
	return "Unknown"
}

func (p Policy) MinPriority() int {
	r0, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GET_PRIORITY_MIN,
		uintptr(p),
		0, 0,
	)
	if e != 0 {
		panic(e)
	}
	return int(r0)
}

func (p Policy) MaxPriority() int {
	r0, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GET_PRIORITY_MAX,
		uintptr(p),
		0, 0,
	)
	if e != 0 {
		panic(e)
	}
	return int(r0)
}

type Param struct {
	Priority int
}

func SetPolicy(pid int, policy Policy, param *Param) error {
	_, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_SETSCHEDULER,
		uintptr(pid),
		uintptr(policy),
		uintptr(unsafe.Pointer(param)),
	)
	if e != 0 {
		return e
	}
	return nil
}

func GetPolicy(pid int) (Policy, error) {
	r0, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GETSCHEDULER,
		uintptr(pid),
		0, 0,
	)
	if e != 0 {
		return 0, e
	}
	return Policy(r0), nil
}

func SetParam(pid int, param *Param) error {
	_, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_SETPARAM,
		uintptr(pid),
		uintptr(unsafe.Pointer(param)),
		0,
	)
	if e != 0 {
		return e
	}
	return nil

}

func GetParam(pid int, param *Param) error {
	_, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GETPARAM,
		uintptr(pid),
		uintptr(unsafe.Pointer(param)),<commit_msg>Reformatting source code<commit_after>// Package sched contains functions for set/get process scheduling parameters
package sched

import (
	"syscall"
	"unsafe"
)

type Policy uintptr

const (
	Other Policy = 0
	FIFO  Policy = 1
	RR    Policy = 2
	Batch Policy = 3
	Idle  Policy = 5
)

func (p Policy) String() string {
	switch p {
	case Other:
		return "Other"
	case FIFO:
		return "FIFO"
	case RR:
		return "RR"
	case Batch:
		return "Batch"
	case Idle:
		return "Idle"
	}
	return "Unknown"
}

func (p Policy) MinPriority() int {
	r0, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GET_PRIORITY_MIN, uintptr(p), 0, 0,
	)
	if e != 0 {
		panic(e)
	}
	return int(r0)
}

func (p Policy) MaxPriority() int {
	r0, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GET_PRIORITY_MAX, uintptr(p), 0, 0,
	)
	if e != 0 {
		panic(e)
	}
	return int(r0)
}

type Param struct {
	Priority int
}

func SetPolicy(pid int, policy Policy, param *Param) error {
	_, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_SETSCHEDULER,
		uintptr(pid),
		uintptr(policy),
		uintptr(unsafe.Pointer(param)),
	)
	if e != 0 {
		return e
	}
	return nil
}

func GetPolicy(pid int) (Policy, error) {
	r0, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GETSCHEDULER, uintptr(pid), 0, 0,
	)
	if e != 0 {
		return 0, e
	}
	return Policy(r0), nil
}

func SetParam(pid int, param *Param) error {
	_, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_SETPARAM,
		uintptr(pid),
		uintptr(unsafe.Pointer(param)),
		0,
	)
	if e != 0 {
		return e
	}
	return nil

}

func GetParam(pid int, param *Param) error {
	_, _, e := syscall.RawSyscall(
		syscall.SYS_SCHED_GETPARAM,
		uintptr(pid),
		uintptr(unsafe.Pointer(param)),
{'fraction_non_alphanumeric': 0.12772306774097283, 'fraction_numerical': 0.01432408236347359, 'mean_word_length': 3.548168249660787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2304052', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1331, 'n_words': 353}