package mmvdump
import "github.com/performancecopilot/speed/mmvdump"
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, instances map[uint64]Instance, indoms map[uint64]*InstanceDomain, strings map[uint64]*String, err error, )
- func FixedVal(data uint64, t Type) (interface{}, error)
- type Header
- type Instance
- type Instance1
- type Instance2
- type InstanceBase
- func (i InstanceBase) Indom() uint64
- func (i InstanceBase) Internal() int32
- func (i InstanceBase) Padding() uint32
- type InstanceDomain
- type Metric
- type Metric1
- type Metric2
- type MetricBase
- func (m MetricBase) Indom() int32
- func (m MetricBase) Item() uint32
- func (m MetricBase) LongText() uint64
- func (m MetricBase) Padding() uint32
- func (m MetricBase) Sem() Semantics
- func (m MetricBase) ShortText() uint64
- func (m MetricBase) Typ() Type
- func (m MetricBase) Unit() Unit
- 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
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 FixedVal ¶
FixedVal will infer a fixed size value from the passed data
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 Instance ¶
Instance is the base type for all instances
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) Indom ¶
func (i InstanceBase) Indom() uint64
Indom returns the indom offset
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) Indom ¶
func (m MetricBase) Indom() int32
Indom returns the indom id
func (MetricBase) Item ¶
func (m MetricBase) Item() uint32
Item returns the item id
func (MetricBase) LongText ¶
func (m MetricBase) LongText() uint64
LongText returns the longtext offset
func (MetricBase) Padding ¶
func (m MetricBase) Padding() uint32
Padding returns the padding value
func (MetricBase) Sem ¶
func (m MetricBase) Sem() Semantics
Sem returns the semantics
func (MetricBase) ShortText ¶
func (m MetricBase) ShortText() uint64
ShortText returns the shorttext offset
func (MetricBase) Typ ¶
func (m MetricBase) Typ() Type
Typ returns the type
func (MetricBase) Unit ¶
func (m MetricBase) Unit() Unit
Unit returns the unit
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
func (Semantics) String ¶
type String ¶
type String struct { Payload [StringMax]byte }
String wraps the payload for a PCP String
type Toc ¶
Toc defines the contents in a valid TOC
type TocType ¶
type TocType int32
TocType is an enumerated type with different types as values
Values for TocType
func (TocType) String ¶
type Type ¶
type Type int32
Type is an enumerated type representing all valid types for a metric
const ( NoSupportType Type = iota - 1 Int32Type Uint32Type Int64Type Uint64Type FloatType DoubleType StringType UnknownType Type = 255 )
Possible values for a Type
func (Type) String ¶
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
Values for Count Units
func (Unit) String ¶
type Value ¶
type Value struct { // uint64 is a holder type here, while printing it is expected that // the user will infer the value using the Val functions Val uint64 Extra int64 Metric uint64 Instance uint64 }
Value defines the contents in a PCP Value
Source Files ¶
mmvdump.go pcp.go semantics_string.go toctype_string.go type_string.go unit_string.go
Directories ¶
Path | Synopsis |
---|---|
mmvdump/cmd | |
mmvdump/cmd/mmvdump |
- Version
- v2.0.0+incompatible (latest)
- Published
- Apr 5, 2017
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 3 weeks ago –
Tools for package owners.