trace

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AfPacketInput    = "af-packet-input"
	AvfInput         = "avf-input"
	BondProcess      = "bond-process"
	MemifInput       = "memif-input"
	P2pEthernetInput = "p2p-ethernet-input"
	PgInput          = "pg-input"
	PuntSocketRx     = "punt-socket-rx"
	RdmaInput        = "rdma-input"
	SessionQueue     = "session-queue"
	TuntapRx         = "tuntap-rx"
	VhostUserInput   = "vhost-user-input"
	VirtioInput      = "virtio-input"
	Vmxnet3Input     = "vmxnet3-input"

	// Nodes below might be unavailable if some plugin is disabled.
	DpdkCryptoInput = "dpdk-crypto-input"
	DpdkInput       = "dpdk-input"
	HandoffTrace    = "handoff-trace"
	IxgeInput       = "ixge-input"
	MrvlPp2Input    = "mrvl-pp2-input"
	NetmapInput     = "netmap-input"
)

List of trace-able input nodes.

Variables

Functions

func Add

func Add(cli CLI, numPackets int, nodes []string) error

Add starts tracing packets for nodes

func Show

func Show(cli CLI, maxPackets int) (string, error)

Show retrieves trace

Types

type CLI

type CLI interface {
	RunCli(cmd string) (string, error)
}

CLI is an interface for accessing VPP CLI.

type Capture

type Capture struct {
	Name    string        // Name is a name of node in capture
	Start   time.Duration // Start is the elapsed time since boot
	Content string        // Content contains the captured data
}

Capture is a part of traced packet.

func ParseTraceCaptures

func ParseTraceCaptures(pkt string) ([]Capture, error)

ParseTraceCaptures parses a raw packet data from trace output and returns parsed Capture(s) or error if the packet from trace data cannot be parsed.

type Packet

type Packet struct {
	ID       int       // ID is a packet number
	Captures []Capture // Captures is the captured packet data
}

Packet is a traced packet.

func ParseTracePackets

func ParseTracePackets(trace string) (packets []Packet, err error)

ParseResult parses a raw trace output and returns parsed Packet(s) or error if the trace data cannot be parsed.

type Result

type Result struct {
	TraceTime time.Time // TraceTime is the actual time of trace
	Packets   []Packet  // Packets is a list of traced packets
	RawData   string    // RawData is the raw trace data before parsing
}

Result contains trace results.

type Tracer

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

Tracer manages packet tracing.

func NewTracer

func NewTracer(cli CLI) (*Tracer, error)

NewTracer returns Tracer that uses CLI to manage tracing.

func (*Tracer) BeginTrace

func (t *Tracer) BeginTrace(nodes ...string) error

BeginTrace clears the trace and starts tracing packets of nodes.

func (*Tracer) EndTrace

func (t *Tracer) EndTrace() (*Result, error)

EndTrace stops tracing, parses and returns trace Result.

func (*Tracer) SetNumPackets

func (t *Tracer) SetNumPackets(numPackets int)

SetNumPackets sets the number of packets to trace. By default, 5000 packets are traced.

Jump to

Keyboard shortcuts

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