pc

package module
v0.0.0-...-db25d0f Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2015 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Windows performance counters. (MANY THINGS ARE BROKEN)

See http://godoc.org/github.com/alexbrainman/pc for details.

Documentation

Overview

Windows performance counters. (MANY THINGS ARE BROKEN)

Index

Constants

View Source
const (
	PDH_MORE_DATA    = Errno(0x800007d2)
	PDH_INVALID_DATA = Errno(0xC0000BC6)
)
View Source
const (
	// Determines the data type of the formatted value.
	// Specify one of the following values.
	PDH_FMT_DOUBLE = 0x00000200 // Return data as a double-precision floating point real.
	PDH_FMT_LARGE  = 0x00000400 // Return data as a 64-bit integer.
	PDH_FMT_LONG   = 0x00000100 // Return data as a long integer.

	// You can use the bitwise inclusive OR operator to combine
	// the data type with one of the following scaling factors.
	PDH_FMT_NOSCALE  = 0x00001000 // Do not apply the counter's default scaling factor.
	PDH_FMT_NOCAP100 = 0x00008000 // Counter values greater than 100 (for example, counter values measuring the processor load on multiprocessor computers) will not be reset to 100. The default behavior is that counter values are capped at a value of 100.
	PDH_FMT_1000     = 0x00002000 // Multiply the actual value by 1,000.
)

Variables

This section is empty.

Functions

func PdhAddCounter

func PdhAddCounter(query PDH_HQUERY, fullpath *uint16, userdata uint32, counter *PDH_HCOUNTER) (pdherr error)

func PdhCloseQuery

func PdhCloseQuery(query PDH_HQUERY) (pdherr error)

func PdhCollectQueryData

func PdhCollectQueryData(query PDH_HQUERY) (pdherr error)

func PdhGetFormattedCounterArray

func PdhGetFormattedCounterArray(counter PDH_HCOUNTER, format uint32, bufsize *uint32, bufcnt *uint32, item *PDH_FMT_COUNTERVALUE_ITEM) (pdherr error)

func PdhGetFormattedCounterValue

func PdhGetFormattedCounterValue(counter PDH_HCOUNTER, format uint32, ctype *uint32, value *PDH_FMT_COUNTERVALUE) (pdherr error)

func PdhGetRawCounterValue

func PdhGetRawCounterValue(counter PDH_HCOUNTER, ctype *uint32, value *PDH_RAW_COUNTER) (pdherr error)

func PdhOpenQuery

func PdhOpenQuery(datasrc *uint16, userdata uint32, query *PDH_HQUERY) (pdherr error)

func PdhRemoveCounter

func PdhRemoveCounter(counter PDH_HCOUNTER) (pdherr error)

Types

type Counter

type Counter struct {
	Handle PDH_HCOUNTER
}

Performance counter.

func (*Counter) GetFmtValue

func (c *Counter) GetFmtValue(format uint32) (uint32, *PDH_FMT_COUNTERVALUE, error)

func (*Counter) GetRawValue

func (c *Counter) GetRawValue() (uint32, *PDH_RAW_COUNTER, error)

func (*Counter) Remove

func (c *Counter) Remove() error

Remove removes counter c from a query.

type Errno

type Errno uintptr

func (Errno) Error

func (e Errno) Error() string

type FmtArray

type FmtArray struct {
	Items []PDH_FMT_COUNTERVALUE_ITEM
	// contains filtered or unexported fields
}

FmtArray.

func (*FmtArray) Clean

func (a *FmtArray) Clean()

func (*FmtArray) Get

func (a *FmtArray) Get(c *Counter, format uint32) error

type PDH_FMT_COUNTERVALUE

type PDH_FMT_COUNTERVALUE struct {
	CStatus uint32

	Value uint64 // largest value of the union possible
	// contains filtered or unexported fields
}

type PDH_FMT_COUNTERVALUE_ITEM

type PDH_FMT_COUNTERVALUE_ITEM struct {
	Name     *uint16
	FmtValue PDH_FMT_COUNTERVALUE
}

func (*PDH_FMT_COUNTERVALUE_ITEM) NameString

func (i *PDH_FMT_COUNTERVALUE_ITEM) NameString() string

type PDH_HCOUNTER

type PDH_HCOUNTER syscall.Handle

type PDH_HQUERY

type PDH_HQUERY syscall.Handle

type PDH_RAW_COUNTER

type PDH_RAW_COUNTER struct {
	CStatus   uint32
	TimeStamp syscall.Filetime

	FirstValue  int64
	SecondValue int64
	MultiCount  uint32
	// contains filtered or unexported fields
}

func (*PDH_RAW_COUNTER) Time

func (c *PDH_RAW_COUNTER) Time() time.Time

type Query

type Query struct {
	Handle PDH_HQUERY
}

Performance query.

func OpenQuery

func OpenQuery(datasrc string, userdata uint32) (*Query, error)

OpenQuery creates a new query that is used to manage the collection of performance data.

func (*Query) AddCounter

func (q *Query) AddCounter(fullpath string, userdata uint32) (*Counter, error)

AddCounter adds the specified counter to the query q.

func (*Query) Close

func (q *Query) Close() error

Close closes all counters contained in the query q, closes all handles related to the query, and frees all memory associated with the query.

func (*Query) CollectData

func (q *Query) CollectData() error

CollectData collects the current raw data value for all counters in the query q and updates the status code of each counter.

Jump to

Keyboard shortcuts

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