Documentation ¶
Overview ¶
Package mmvdump implements a go port of the C mmvdump utility included in PCP Core
https://github.com/performancecopilot/pcp/blob/master/src/pmdas/mmv/mmvdump.c
It has been written for maximum portability with the C equivalent, without having to use cgo or any other ninja stuff ¶
the main difference is that the reader is separate from the cli with the reading primarily implemented in mmvdump.go while the cli is implemented in cmd/mmvdump
the cli application is completely go gettable and outputs the same things, in mostly the same way as the C cli app, to try it out,
``` go get github.com/performancecopilot/speed/mmvdump/cmd/mmvdump ```
Index ¶
- Constants
- func Dump(data []byte) (h *Header, tocs []*Toc, metrics map[uint64]Metric, values map[uint64]*Value, ...)
- func FixedVal(data uint64, t Type) (interface{}, error)
- func Write(w io.Writer, header *Header, tocs []*Toc, metrics map[uint64]Metric, ...) error
- type Header
- type Instance
- type Instance1
- type Instance2
- type InstanceBase
- type InstanceDomain
- type Metric
- type Metric1
- type Metric2
- type MetricBase
- type Semantics
- type String
- type Toc
- type TocType
- type Type
- type Unit
- type Value
Constants ¶
const ( // NameMax is the maximum allowed length of a name NameMax = 64 // StringMax is the maximum allowed length of a string StringMax = 256 // NoIndom is a constant used to indicate absence of an indom from a metric NoIndom = -1 )
const ( HeaderLength uint64 = 40 TocLength uint64 = 16 Metric1Length uint64 = 104 Metric2Length uint64 = 48 ValueLength uint64 = 32 Instance1Length uint64 = 80 Instance2Length uint64 = 24 InstanceDomainLength uint64 = 32 StringLength uint64 = 256 )
Byte Lengths for Different Components
const MMVVersion = 1
MMVVersion is the current mmv format version
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
func Dump(data []byte) ( h *Header, tocs []*Toc, metrics map[uint64]Metric, values map[uint64]*Value, instances map[uint64]Instance, indoms map[uint64]*InstanceDomain, strings map[uint64]*String, err error, )
Dump creates a data dump from the passed data
func Write ¶
func Write( w io.Writer, header *Header, tocs []*Toc, metrics map[uint64]Metric, values map[uint64]*Value, instances map[uint64]Instance, indoms map[uint64]*InstanceDomain, strings map[uint64]*String, ) error
Write creates a writable representation of a MMV dump and writes it to the passed writer.
Types ¶
type Header ¶
type Header struct { Magic [4]byte Version int32 G1, G2 uint64 Toc int32 Flag int32 Process, Cluster int32 }
Header describes the data in a MMV header
type Instance1 ¶
type Instance1 struct { InstanceBase External [NameMax]byte }
Instance1 defines the contents in a valid mmv1 instance
type Instance2 ¶
type Instance2 struct { InstanceBase External uint64 }
Instance2 defines the contents in a valid mmv2 instance
type InstanceBase ¶
type InstanceBase struct {
// contains filtered or unexported fields
}
InstanceBase defines the common contents in a valid instance
func (InstanceBase) Internal ¶
func (i InstanceBase) Internal() int32
Internal returns the internal id
func (InstanceBase) Padding ¶
func (i InstanceBase) Padding() uint32
Padding returns the padding value
type InstanceDomain ¶
InstanceDomain defines the contents in a valid instance domain
type Metric ¶
type Metric interface { Item() uint32 Typ() Type Sem() Semantics Unit() Unit Indom() int32 Padding() uint32 ShortText() uint64 LongText() uint64 }
Metric is the base type for all metrics
type Metric1 ¶
type Metric1 struct { Name [NameMax]byte MetricBase }
Metric1 defines the contents in a valid Metric
type Metric2 ¶
type Metric2 struct { Name uint64 MetricBase }
Metric2 defines the contents in a valid Metric
type MetricBase ¶
type MetricBase struct {
// contains filtered or unexported fields
}
MetricBase defines the common contents in a valid Metric
func (MetricBase) LongText ¶
func (m MetricBase) LongText() uint64
LongText returns the longtext offset
func (MetricBase) ShortText ¶
func (m MetricBase) ShortText() uint64
ShortText returns the shorttext offset
type Semantics ¶
type Semantics int32
Semantics represents an enumerated type representing all possible semantics of a metric
const ( NoSemantics Semantics = 0 CounterSemantics InstantSemantics DiscreteSemantics )
Values for Semantics
type TocType ¶
type TocType int32
TocType is an enumerated type with different types as values
Values for TocType
type Type ¶
type Type int32
Type is an enumerated type representing all valid types for a metric
type Unit ¶
type Unit uint32
Unit is an enumerated type with all possible units as values
const ( ByteUnit Unit = 1<<28 | iota<<16 KilobyteUnit MegabyteUnit GigabyteUnit TerabyteUnit PetabyteUnit ExabyteUnit )
Values for Space Units
const ( NanosecondUnit Unit = 1<<24 | iota<<12 MicrosecondUnit MillisecondUnit SecondUnit MinuteUnit HourUnit )
Values for Time Units
func (Unit) CountDim ¶
CountDim gets the count dimension of the unit the right shift is on int32 to get an arithmetic right shift as the dimension is serialized in 2s complement form
https://docs.rs/hornet/0.1.0/src/hornet/client/metric/mod.rs.html#410
func (Unit) CountScale ¶
CountScale gets the Count Scale of a unit
https://docs.rs/hornet/0.1.0/src/hornet/client/metric/mod.rs.html#406
func (Unit) SpaceDim ¶
SpaceDim gets the space dimension of the unit the right shift is on int32 to get an arithmetic right shift as the dimension is serialized in 2s complement form
https://docs.rs/hornet/0.1.0/src/hornet/client/metric/mod.rs.html#410
func (Unit) SpaceScale ¶
SpaceScale gets the Space Scale of a unit
https://docs.rs/hornet/0.1.0/src/hornet/client/metric/mod.rs.html#398
func (Unit) TimeDim ¶
TimeDim gets the time dimension of the unit the right shift is on int32 to get an arithmetic right shift as the dimension is serialized in 2s complement form
https://docs.rs/hornet/0.1.0/src/hornet/client/metric/mod.rs.html#410
func (Unit) TimeScale ¶
TimeScale gets the Time Scale of a unit
https://docs.rs/hornet/0.1.0/src/hornet/client/metric/mod.rs.html#402