process

package
v0.0.0-...-1e8dc9b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Index

Constants

View Source
const (
	NotFoundProcessPID = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	Prioritize() error
	ThreadID() int
	ProcessID() int
	Exists(pid int) (bool, error)
	Find(pid int) (*os.Process, error)
	Signal(process *os.Process, signal os.Signal) error
	SetAffinity([]int) error
}

Manager manages a process

func NewManager

func NewManager(dryRun bool) Manager

NewManager creates a new process manager

type ManagerMock

type ManagerMock struct {
	mock.Mock
}

ManagerMock is an autogenerated mock type for the Manager type

func NewManagerMock

func NewManagerMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *ManagerMock

NewManagerMock creates a new instance of ManagerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*ManagerMock) EXPECT

func (_m *ManagerMock) EXPECT() *ManagerMock_Expecter

func (*ManagerMock) Exists

func (_m *ManagerMock) Exists(pid int) (bool, error)

Exists provides a mock function with given fields: pid

func (*ManagerMock) Find

func (_m *ManagerMock) Find(pid int) (*os.Process, error)

Find provides a mock function with given fields: pid

func (*ManagerMock) Prioritize

func (_m *ManagerMock) Prioritize() error

Prioritize provides a mock function with given fields:

func (*ManagerMock) ProcessID

func (_m *ManagerMock) ProcessID() int

ProcessID provides a mock function with given fields:

func (*ManagerMock) SetAffinity

func (_m *ManagerMock) SetAffinity(_a0 []int) error

SetAffinity provides a mock function with given fields: _a0

func (*ManagerMock) Signal

func (_m *ManagerMock) Signal(process *os.Process, signal os.Signal) error

Signal provides a mock function with given fields: process, signal

func (*ManagerMock) ThreadID

func (_m *ManagerMock) ThreadID() int

ThreadID provides a mock function with given fields:

type ManagerMock_Exists_Call

type ManagerMock_Exists_Call struct {
	*mock.Call
}

ManagerMock_Exists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exists'

func (*ManagerMock_Exists_Call) Return

func (*ManagerMock_Exists_Call) Run

func (_c *ManagerMock_Exists_Call) Run(run func(pid int)) *ManagerMock_Exists_Call

func (*ManagerMock_Exists_Call) RunAndReturn

func (_c *ManagerMock_Exists_Call) RunAndReturn(run func(int) (bool, error)) *ManagerMock_Exists_Call

type ManagerMock_Expecter

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

func (*ManagerMock_Expecter) Exists

func (_e *ManagerMock_Expecter) Exists(pid interface{}) *ManagerMock_Exists_Call

Exists is a helper method to define mock.On call

  • pid int

func (*ManagerMock_Expecter) Find

func (_e *ManagerMock_Expecter) Find(pid interface{}) *ManagerMock_Find_Call

Find is a helper method to define mock.On call

  • pid int

func (*ManagerMock_Expecter) Prioritize

Prioritize is a helper method to define mock.On call

func (*ManagerMock_Expecter) ProcessID

ProcessID is a helper method to define mock.On call

func (*ManagerMock_Expecter) SetAffinity

func (_e *ManagerMock_Expecter) SetAffinity(_a0 interface{}) *ManagerMock_SetAffinity_Call

SetAffinity is a helper method to define mock.On call

  • _a0 []int

func (*ManagerMock_Expecter) Signal

func (_e *ManagerMock_Expecter) Signal(process interface{}, signal interface{}) *ManagerMock_Signal_Call

Signal is a helper method to define mock.On call

  • process *os.Process
  • signal os.Signal

func (*ManagerMock_Expecter) ThreadID

ThreadID is a helper method to define mock.On call

type ManagerMock_Find_Call

type ManagerMock_Find_Call struct {
	*mock.Call
}

ManagerMock_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'

func (*ManagerMock_Find_Call) Return

func (*ManagerMock_Find_Call) Run

func (_c *ManagerMock_Find_Call) Run(run func(pid int)) *ManagerMock_Find_Call

func (*ManagerMock_Find_Call) RunAndReturn

func (_c *ManagerMock_Find_Call) RunAndReturn(run func(int) (*os.Process, error)) *ManagerMock_Find_Call

type ManagerMock_Prioritize_Call

type ManagerMock_Prioritize_Call struct {
	*mock.Call
}

ManagerMock_Prioritize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prioritize'

func (*ManagerMock_Prioritize_Call) Return

func (*ManagerMock_Prioritize_Call) Run

func (*ManagerMock_Prioritize_Call) RunAndReturn

func (_c *ManagerMock_Prioritize_Call) RunAndReturn(run func() error) *ManagerMock_Prioritize_Call

type ManagerMock_ProcessID_Call

type ManagerMock_ProcessID_Call struct {
	*mock.Call
}

ManagerMock_ProcessID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessID'

func (*ManagerMock_ProcessID_Call) Return

func (*ManagerMock_ProcessID_Call) Run

func (*ManagerMock_ProcessID_Call) RunAndReturn

func (_c *ManagerMock_ProcessID_Call) RunAndReturn(run func() int) *ManagerMock_ProcessID_Call

type ManagerMock_SetAffinity_Call

type ManagerMock_SetAffinity_Call struct {
	*mock.Call
}

ManagerMock_SetAffinity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAffinity'

func (*ManagerMock_SetAffinity_Call) Return

func (*ManagerMock_SetAffinity_Call) Run

func (*ManagerMock_SetAffinity_Call) RunAndReturn

func (_c *ManagerMock_SetAffinity_Call) RunAndReturn(run func([]int) error) *ManagerMock_SetAffinity_Call

type ManagerMock_Signal_Call

type ManagerMock_Signal_Call struct {
	*mock.Call
}

ManagerMock_Signal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Signal'

func (*ManagerMock_Signal_Call) Return

func (*ManagerMock_Signal_Call) Run

func (_c *ManagerMock_Signal_Call) Run(run func(process *os.Process, signal os.Signal)) *ManagerMock_Signal_Call

func (*ManagerMock_Signal_Call) RunAndReturn

func (_c *ManagerMock_Signal_Call) RunAndReturn(run func(*os.Process, os.Signal) error) *ManagerMock_Signal_Call

type ManagerMock_ThreadID_Call

type ManagerMock_ThreadID_Call struct {
	*mock.Call
}

ManagerMock_ThreadID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ThreadID'

func (*ManagerMock_ThreadID_Call) Return

func (*ManagerMock_ThreadID_Call) Run

func (*ManagerMock_ThreadID_Call) RunAndReturn

func (_c *ManagerMock_ThreadID_Call) RunAndReturn(run func() int) *ManagerMock_ThreadID_Call

type Runtime

type Runtime interface {
	// GOMAXPROCS sets the maximum number of CPUs that can be executing
	// simultaneously and returns the previous setting. It defaults to
	// the value of runtime.NumCPU. If n < 1, it does not change the current setting.
	// This call will go away when the scheduler improves.	GOMAXPROCS(int) int
	GOMAXPROCS(int) int

	// LockOSThread wires the calling goroutine to its current operating system thread.
	// The calling goroutine will always execute in that thread,
	// and no other goroutine will execute in it,
	// until the calling goroutine has made as many calls to
	// UnlockOSThread as to LockOSThread.
	// If the calling goroutine exits without unlocking the thread,
	// the thread will be terminated.
	//
	// All init functions are run on the startup thread. Calling LockOSThread
	// from an init function will cause the main function to be invoked on
	// that thread.
	//
	// A goroutine should call LockOSThread before calling OS services or
	// non-Go library functions that depend on per-thread state.
	LockOSThread()

	// UnlockOSThread undoes an earlier call to LockOSThread.
	// If this drops the number of active LockOSThread calls on the
	// calling goroutine to zero, it unwires the calling goroutine from
	// its fixed operating system thread.
	// If there are no active LockOSThread calls, this is a no-op.
	//
	// Before calling UnlockOSThread, the caller must ensure that the OS
	// thread is suitable for running other goroutines. If the caller made
	// any permanent changes to the state of the thread that would affect
	// other goroutines, it should not call this function and thus leave
	// the goroutine locked to the OS thread until the goroutine (and
	// hence the thread) exits.
	UnlockOSThread()
}

func NewRuntime

func NewRuntime(dryRun bool) Runtime

type RuntimeMock

type RuntimeMock struct {
	mock.Mock
}

RuntimeMock is an autogenerated mock type for the Runtime type

func NewRuntimeMock

func NewRuntimeMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *RuntimeMock

NewRuntimeMock creates a new instance of RuntimeMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*RuntimeMock) EXPECT

func (_m *RuntimeMock) EXPECT() *RuntimeMock_Expecter

func (*RuntimeMock) GOMAXPROCS

func (_m *RuntimeMock) GOMAXPROCS(_a0 int) int

GOMAXPROCS provides a mock function with given fields: _a0

func (*RuntimeMock) LockOSThread

func (_m *RuntimeMock) LockOSThread()

LockOSThread provides a mock function with given fields:

func (*RuntimeMock) UnlockOSThread

func (_m *RuntimeMock) UnlockOSThread()

UnlockOSThread provides a mock function with given fields:

type RuntimeMock_Expecter

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

func (*RuntimeMock_Expecter) GOMAXPROCS

func (_e *RuntimeMock_Expecter) GOMAXPROCS(_a0 interface{}) *RuntimeMock_GOMAXPROCS_Call

GOMAXPROCS is a helper method to define mock.On call

  • _a0 int

func (*RuntimeMock_Expecter) LockOSThread

LockOSThread is a helper method to define mock.On call

func (*RuntimeMock_Expecter) UnlockOSThread

UnlockOSThread is a helper method to define mock.On call

type RuntimeMock_GOMAXPROCS_Call

type RuntimeMock_GOMAXPROCS_Call struct {
	*mock.Call
}

RuntimeMock_GOMAXPROCS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GOMAXPROCS'

func (*RuntimeMock_GOMAXPROCS_Call) Return

func (*RuntimeMock_GOMAXPROCS_Call) Run

func (*RuntimeMock_GOMAXPROCS_Call) RunAndReturn

func (_c *RuntimeMock_GOMAXPROCS_Call) RunAndReturn(run func(int) int) *RuntimeMock_GOMAXPROCS_Call

type RuntimeMock_LockOSThread_Call

type RuntimeMock_LockOSThread_Call struct {
	*mock.Call
}

RuntimeMock_LockOSThread_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LockOSThread'

func (*RuntimeMock_LockOSThread_Call) Return

func (*RuntimeMock_LockOSThread_Call) Run

func (*RuntimeMock_LockOSThread_Call) RunAndReturn

func (_c *RuntimeMock_LockOSThread_Call) RunAndReturn(run func()) *RuntimeMock_LockOSThread_Call

type RuntimeMock_UnlockOSThread_Call

type RuntimeMock_UnlockOSThread_Call struct {
	*mock.Call
}

RuntimeMock_UnlockOSThread_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnlockOSThread'

func (*RuntimeMock_UnlockOSThread_Call) Return

func (*RuntimeMock_UnlockOSThread_Call) Run

func (*RuntimeMock_UnlockOSThread_Call) RunAndReturn

Jump to

Keyboard shortcuts

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