registry

package
v0.30.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CounterNameTable = *QueryNameTable("Counter 009")

CounterNameTable Initialize global name tables profiling, add option to disable name tables if necessary Not sure if we should resolve the names at all or just have the caller do it on demand (for many use cases the index is sufficient)

Functions

func MapCounterToIndex

func MapCounterToIndex(name string) string

Types

type Collector

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

func NewCollector

func NewCollector[T any](object string, _ []string) (*Collector, error)

func (*Collector) Close

func (c *Collector) Close()

func (*Collector) Collect

func (c *Collector) Collect(data any) error

func (*Collector) Describe

func (c *Collector) Describe() map[string]string

type Counter

type Counter struct {
	Name      string
	Desc      string
	Instances map[string]uint32
	Type      uint32
	Frequency float64

	FieldIndexValue       int
	FieldIndexSecondValue int
}

type NameTable

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

func QueryNameTable

func QueryNameTable(tableName string) *NameTable

QueryNameTable Query a perflib name table from the v1. Specify the type and the language code (i.e. "Counter 009" or "Help 009") for English language.

func (*NameTable) LookupIndex

func (t *NameTable) LookupIndex(str string) uint32

func (*NameTable) LookupString

func (t *NameTable) LookupString(index uint32) string

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, counterName 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.

Jump to

Keyboard shortcuts

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