Documentation ¶
Index ¶
- Constants
- Variables
- func GetPerflibSnapshot(objNames string) (map[string]*PerfObject, error)
- func MapCounterToIndex(name string) string
- func UnmarshalObject(obj *PerfObject, vs interface{}, logger *slog.Logger) error
- type NameTable
- type PerfCounter
- type PerfCounterDef
- type PerfInstance
- type PerfObject
Constants ¶
const ( PERF_COUNTER_COUNTER = 0x10410400 PERF_100NSEC_TIMER = 0x20510500 PERF_PRECISION_100NS_TIMER = 0x20570500 PERF_ELAPSED_TIME = 0x30240500 )
const ( TicksToSecondScaleFactor = 1 / 1e7 WindowsEpoch = 116444736000000000 )
Conversion factors.
Variables ¶
var CounterNameTable = *QueryNameTable("Counter 009")
Functions ¶
func GetPerflibSnapshot ¶
func GetPerflibSnapshot(objNames string) (map[string]*PerfObject, error)
func MapCounterToIndex ¶
func UnmarshalObject ¶
func UnmarshalObject(obj *PerfObject, vs interface{}, logger *slog.Logger) error
Types ¶
type NameTable ¶
type NameTable struct {
// contains filtered or unexported fields
}
func QueryNameTable ¶
QueryNameTable Query a perflib name table from the registry. Specify the type and the language code (i.e. "Counter 009" or "Help 009") for English language.
func (*NameTable) LookupIndex ¶
func (*NameTable) LookupString ¶
type PerfCounter ¶
type PerfCounter struct { Value int64 Def *PerfCounterDef SecondValue int64 }
type PerfCounterDef ¶
type PerfCounterDef struct { Name string NameIndex uint // For debugging - subject to removal. CounterType is a perflib // implementation detail (see perflib.h) and should not be used outside // of this package. We export it so we can show it on /dump. CounterType uint32 // PERF_TYPE_COUNTER (otherwise, it's a gauge) IsCounter bool // PERF_COUNTER_BASE (base value of a multi-value fraction) IsBaseValue bool // PERF_TIMER_100NS IsNanosecondCounter bool HasSecondValue bool // contains filtered or unexported fields }
type PerfInstance ¶
type PerfInstance struct { // *not* resolved using a name table Name string Counters []*PerfCounter // contains filtered or unexported fields }
PerfInstance Each object can have multiple instances. For example, In case the object has no instances, we return one single PerfInstance with an empty name.
type PerfObject ¶
type PerfObject struct { Name string // NameIndex Same index you pass to QueryPerformanceData NameIndex uint Instances []*PerfInstance CounterDefs []*PerfCounterDef Frequency int64 // contains filtered or unexported fields }
PerfObject Top-level performance object (like "Process").
func QueryPerformanceData ¶
func QueryPerformanceData(query string) ([]*PerfObject, error)
QueryPerformanceData Query all performance counters that match a given query.
The query can be any of the following:
- "Global" (all performance counters except those Windows marked as costly)
- "Costly" (only the costly ones)
- One or more object indices, separated by spaces ("238 2 5")
Many objects have dependencies - if you query one of them, you often get back more than you asked for.