Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Type string `json:"type"` // "LOCK" or "RLOCK"
State string `json:"state"` // "START", "ACQUIRED", or "RELEASED"
Name string `json:"name"` // mutex name
ID int `json:"id"` // correlation ID
Trace string `json:"trace,omitempty"` // optional stack trace
Ts int64 `json:"ts"` // unix nanoseconds
}
Event represents a lock operation for logging.
type LogFunc ¶
type LogFunc func(Event)
LogFunc is a function that handles lock events.
func WriterLogger ¶
WriterLogger returns a LogFunc that writes JSON events to the given writer.
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
Mutex is a logged wrapper around sync.RWMutex. It can be used as a drop-in replacement for both sync.Mutex and sync.RWMutex.
func (*Mutex) Lock ¶
func (m *Mutex) Lock()
Lock acquires the write lock. Uses type "WLOCK" which does not track RELEASED (use LockFunc for that).
func (*Mutex) LockFunc ¶
func (m *Mutex) LockFunc() func()
LockFunc acquires the write lock and returns an unlock function that logs the RELEASED event with a correlated ID. Uses type "LOCK" which tracks the full lifecycle.
func (*Mutex) RLock ¶
func (m *Mutex) RLock()
RLock acquires the read lock. Uses type "RWLOCK" which does not track RELEASED (use RLockFunc for that).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package analyze provides tools for analyzing deadlog output to detect deadlocks.
|
Package analyze provides tools for analyzing deadlog output to detect deadlocks. |
|
cmd
|
|
|
deadlog
command
Command deadlog analyzes lock logs for deadlock detection.
|
Command deadlog analyzes lock logs for deadlock detection. |