util

package
v0.0.0-...-8680cc4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMajMinNumOfDevice

func GetMajMinNumOfDevice(device string) (string, bool)

GetMajMinNumOfDevice is used for getting major:minor device number

func ParseCgroupFile

func ParseCgroupFile(text string) map[string]string

ParseCgroupFile parse cgroup path from cgroup file

func PartialEqual

func PartialEqual(obtain, expect string) error

PartialEqual is used for check if string 'obtain' has substring 'expect', return can be used in check.Assert() or somewhere else.

func StringSliceTrimSpace

func StringSliceTrimSpace(input []string) ([]string, error)

StringSliceTrimSpace delete empty items from string slice

func TmpFileWithContent

func TmpFileWithContent(content string) (string, error)

TmpFileWithContent provide tmp file

func TrimAllSpaceAndNewline

func TrimAllSpaceAndNewline(input string) string

TrimAllSpaceAndNewline is used to strip all empty space and newline from a string.

func WaitTimeout

func WaitTimeout(timeout time.Duration, condition func() bool) bool

WaitTimeout wait at most timeout nanoseconds, until the condition become true or timeout reached.

Types

type Goroutine

type Goroutine struct {
	ID         int64
	Stacktrace string
}

Goroutine represents the goroutine from runtime.Stack.

func GoroutinesFromStack

func GoroutinesFromStack(stacks []byte) []*Goroutine

GoroutinesFromStack returns the Goroutine by the stack information.

Jump to

Keyboard shortcuts

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