cutil

package
v0.0.0-...-59848b6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckProbability

func CheckProbability(prob string) bool

func GetCurFileDir

func GetCurFileDir() string

func LoadCachedFile

func LoadCachedFile(filepath string) ([]byte, error)

Types

type Clock

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

func NewClock

func NewClock() *Clock

func (*Clock) IsPaused

func (c *Clock) IsPaused() bool

func (*Clock) Now

func (c *Clock) Now() time.Duration

func (*Clock) Pause

func (c *Clock) Pause()

func (*Clock) Resume

func (c *Clock) Resume()

type PeriodicProbabilityChecker

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

func NewPeriodicProbabilityChecker

func NewPeriodicProbabilityChecker(prob string, period time.Duration) *PeriodicProbabilityChecker

func (*PeriodicProbabilityChecker) Check

func (twp *PeriodicProbabilityChecker) Check() bool

func (*PeriodicProbabilityChecker) Reset

func (twp *PeriodicProbabilityChecker) Reset(clock *Clock)

type Stopwatch

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

func NewStopwatch

func NewStopwatch(clock *Clock) *Stopwatch

func (*Stopwatch) Reset

func (s *Stopwatch) Reset()

func (*Stopwatch) Start

func (s *Stopwatch) Start()

func (*Stopwatch) Stop

func (s *Stopwatch) Stop()

func (*Stopwatch) Total

func (s *Stopwatch) Total() time.Duration

type ThreadSafeFIFO

type ThreadSafeFIFO struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewThreadSafeFIFO

func NewThreadSafeFIFO(cap int) *ThreadSafeFIFO

func (*ThreadSafeFIFO) Push

func (f *ThreadSafeFIFO) Push(e interface{})

func (*ThreadSafeFIFO) TryPop

func (f *ThreadSafeFIFO) TryPop() (interface{}, bool)

Jump to

Keyboard shortcuts

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