kvm

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package kvm reads KVM-specific debugfs data.

The package currently supports the nested_run counter exposed under:

/sys/kernel/debug/kvm/*/nested_run

Each KVM debugfs directory is keyed by the PID of the userspace process that owns the KVM VM. The package intentionally does not assume that process is QEMU. Callers that need libvirt, QEMU, or OpenStack metadata should enrich the returned PID in a higher-level package.

Example:

dfs, err := debugfs.DefaultFS()
if err != nil {
	return err
}

runs, err := kvm.NewFS(dfs).NestedRuns(ctx)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

FS reads KVM-specific debugfs data.

func NewFS

func NewFS(dfs debugfs.FS) FS

NewFS returns a KVM debugfs reader backed by dfs.

func (FS) NestedRuns

func (fs FS) NestedRuns(ctx context.Context) ([]NestedRun, error)

NestedRuns reads all KVM nested_run counters exposed by debugfs.

type NestedRun

type NestedRun struct {
	// PID is the userspace process ID associated with the KVM VM.
	PID int

	// Path is the debugfs file that provided Count.
	Path string

	// Count is the value of the KVM nested_run counter.
	Count uint64
}

Jump to

Keyboard shortcuts

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