process

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCPUUsage

func GetCPUUsage() (float64, error)

GetCPUUsage returns current CPU usage percentage

Types

type Capacity

type Capacity struct {
	CPUCores           int
	AvailableMemory    uint64
	NetworkInterfaces  []string
	MaxProcesses       int
	AvailableProcesses int
}

Capacity represents system resource capacity

type CapacityCalculator

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

CapacityCalculator calculates system resource capacity

func NewCapacityCalculator

func NewCapacityCalculator(maxProcesses int) *CapacityCalculator

NewCapacityCalculator creates a new capacity calculator

func (*CapacityCalculator) DetectCapacity

func (c *CapacityCalculator) DetectCapacity() (*Capacity, error)

DetectCapacity detects current system capacity

func (*CapacityCalculator) GetAvailableSlots

func (c *CapacityCalculator) GetAvailableSlots() int

GetAvailableSlots returns the number of available process slots

func (*CapacityCalculator) GetUsedSlots

func (c *CapacityCalculator) GetUsedSlots() int

GetUsedSlots returns the number of used process slots

func (*CapacityCalculator) ReleaseSlots

func (c *CapacityCalculator) ReleaseSlots(count int)

ReleaseSlots releases process slots

func (*CapacityCalculator) ReserveSlots

func (c *CapacityCalculator) ReserveSlots(count int) error

ReserveSlots reserves process slots

type Manager

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

Manager manages iperf3 processes

func NewManager

func NewManager(portAllocator *port.Allocator, capacity *CapacityCalculator, resultCollector *collector.Collector, iperfPath string) *Manager

NewManager creates a new process manager

func (*Manager) GetProcessInfo

func (m *Manager) GetProcessInfo(testID string) (*ProcessInfo, error)

GetProcessInfo returns information about a process

func (*Manager) GetRunningCount

func (m *Manager) GetRunningCount() int

GetRunningCount returns the number of running processes

func (*Manager) GetServerCount

func (m *Manager) GetServerCount() int

GetServerCount returns the number of running servers

func (*Manager) IsServerRunning

func (m *Manager) IsServerRunning(port int) bool

IsServerRunning checks if a server is running on a port

func (*Manager) StartClient

func (m *Manager) StartClient(testID, host string, port int, config *iperf.Config) error

StartClient starts an iperf3 client test

func (*Manager) StartServer

func (m *Manager) StartServer(port int) error

StartServer starts an iperf3 server on the specified port

func (*Manager) StopAll

func (m *Manager) StopAll() int

StopAll stops all running processes

func (*Manager) StopAllClients

func (m *Manager) StopAllClients() int

StopAllClients stops all running clients

func (*Manager) StopAllServers

func (m *Manager) StopAllServers() int

StopAllServers stops all running servers

func (*Manager) StopProcess

func (m *Manager) StopProcess(testID string) error

StopProcess stops a specific process

type ProcessInfo

type ProcessInfo struct {
	TestID    string
	PID       int
	Port      int
	Mode      iperf.Mode
	StartTime time.Time
	Cmd       *exec.Cmd
	Cancel    context.CancelFunc
}

ProcessInfo contains information about a running process

Jump to

Keyboard shortcuts

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