types

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package types defines the internal class-definition struct used by the cpuclass writers (cpufreq, cpuidle, uncorefreq). It exists as a separate package so each writer can depend on the same struct without depending on the public cpuclass API or on the soon-to-be-deprecated control/cpu config package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocationHints

type AllocationHints struct {
	Prefer []CpuPreference
	Avoid  []CpuPreference
}

AllocationHints carries technology-agnostic placement preferences for an upcoming allocation. Both slices are ordered by descending priority.

type AllocationIntent

type AllocationIntent struct {
	// ClassName is the cpuClass the upcoming allocation will use.
	ClassName string
	// CurrentCpus are the CPUs the caller already owns.
	CurrentCpus cpuset.CPUSet
	// FreeCpus are the CPUs the allocation can pick from. Prefer
	// hints never contain CPUs outside this set.
	FreeCpus cpuset.CPUSet
	// RequestedCount is the number of CPUs the allocation wants.
	// A negative count means releasing that many CPUs from
	// CurrentCpus. Zero is reserved and unspecified.
	RequestedCount int
}

AllocationIntent describes an upcoming CPU allocation for which the caller wants placement preferences. Lives here so internal helpers (e.g. pct) can implement Hints without depending on the public cpuclass package.

type CPUSet

type CPUSet = cpuset.CPUSet

CPUSet aliases cpuset.CPUSet for callers that want to refer to it via this package without re-importing pkg/utils/cpuset.

type ClassDef

type ClassDef struct {
	MinFreq                     uint
	MaxFreq                     uint
	EnergyPerformancePreference uint
	UncoreMinFreq               uint
	UncoreMaxFreq               uint
	FreqGovernor                string
	DisabledCstates             []string
}

ClassDef is the resolved, platform-aware definition of a CPU class as consumed by the writers. All frequency fields are in kHz; zero means "no enforcement". Symbolic frequencies in the user-facing configuration are resolved before being placed into a ClassDef.

func (ClassDef) Equal

func (c ClassDef) Equal(other ClassDef) bool

Equal reports whether two ClassDef values describe identical per-CPU enforcement. Used by the handler to decide whether a class-table change actually requires re-programming CPUs.

type CpuPreference

type CpuPreference struct {
	Name string
	Cpus []cpuset.CPUSet
}

CpuPreference is a named, priority-ordered list of candidate CPU sets carrying a single placement preference (prefer or avoid depending on the slice it appears in). Cpus lists candidate sets ordered from most to least preferred: an allocation should honor the first candidate it can and ignore others.

Jump to

Keyboard shortcuts

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