Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // TargetThisGoroutine monitors the calling goroutine. This will call // [runtime.LockOSThread] on Open and [runtime.UnlockOSThread] on Close. TargetThisGoroutine = targetThisGoroutine{} )
Functions ¶
This section is empty.
Types ¶
type Count ¶
type Count struct { RawValue uint64 // The number of events while this counter was running. TimeEnabled uint64 // Total time the Counter was started. TimeRunning uint64 // Total time the Counter was actually counting. // contains filtered or unexported fields }
Count is the value of a Counter.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
A Counter reports the number of times a events.Event or group of Events occurred.
func OpenCounter ¶
OpenCounter returns a new Counter that reads values for the given events.Event or group of Events on the given Target. Callers are expected to call Counter.Close when done with this Counter.
If multiple events are given, they are opened as a group, which means they will all be scheduled onto the hardware at the same time.
The counter is initially not running. Call Counter.Start to start it.
func (*Counter) Close ¶
func (c *Counter) Close()
Close closes this counter and unlocks the goroutine from the OS thread.
func (*Counter) ReadOne ¶
ReadOne returns the current value of the first event in c. For counters that only have a single Event, this is faster and more ergonomic than Counter.ReadGroup.