lockwatcher

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockWatcher

type LockWatcher struct {
	LockWatcherOptions
	// contains filtered or unexported fields
}

func New

func New(lock sync.Locker, options LockWatcherOptions) *LockWatcher

func (*LockWatcher) GetOptions

func (lw *LockWatcher) GetOptions() LockWatcherOptions

func (*LockWatcher) GetStats

func (lw *LockWatcher) GetStats() LockWatcherStats

func (*LockWatcher) Stop

func (lw *LockWatcher) Stop()

func (*LockWatcher) WriteHtml

func (lw *LockWatcher) WriteHtml(writer io.Writer,
	prefix string) (bool, error)

WriteHtml will write HTML-formatted statistics information to writer, with an optional prefix. It returns true if something was written, else false.

type LockWatcherOptions

type LockWatcherOptions struct {
	CheckInterval      time.Duration // Default: 5 seconds, minimum: 1 second.
	Function           func()
	Logger             log.DebugLogger
	RFunction          func()
	LogTimeout         time.Duration // Default: 1 second, min: 1 millisecond.
	MaximumTryInterval time.Duration // Default/maximum: LogTimeout/32.
	MinimumTryInterval time.Duration // Default/maximum: LogTimeout/256.
}

type LockWatcherStats

type LockWatcherStats struct {
	NumLockTimeouts  uint64 // Populated for sync.Mutex
	NumRLockTimeouts uint64 // Populated for sync.RWMutex
	NumWLockTimeouts uint64 // Populated for sync.RWMutex
	WaitingForLock   bool   // Populated for sync.Mutex
	WaitingForRLock  bool   // Populated for sync.RWMutex
	WaitingForWLock  bool   // Populated for sync.RWMutex
}

type RWLock

type RWLock interface {
	sync.Locker
	RLock()
	RUnlock()
	TryLock() bool
}

Jump to

Keyboard shortcuts

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