Documentation ¶
Overview ¶
Package tgconsumer implements a traffic generator consumer.
Index ¶
- Constants
- Variables
- type Config
- type Consumer
- func (c *Consumer) ClearCounters()
- func (c *Consumer) Close() error
- func (c *Consumer) ConnectRxQueues(demuxD, demuxN *iface.InputDemux)
- func (c *Consumer) Counters() (cnt Counters)
- func (c Consumer) Face() iface.Face
- func (c Consumer) Interval() time.Duration
- func (c *Consumer) Launch()
- func (c Consumer) Patterns() []Pattern
- func (c *Consumer) Stop() error
- func (c *Consumer) StopDelay(delay time.Duration) error
- func (c Consumer) Workers() []ealthread.ThreadWithRole
- type Counters
- type PacketCounters
- type Pattern
- type PatternCounters
Constants ¶
const ( // MaxPatterns is maximum number of traffic patterns. MaxPatterns = 128 // MaxSumWeight is maximum sum of weights among traffic patterns. MaxSumWeight = 8192 // DigestLowWatermark is the number of remaining Data packets in the crypto device before enqueuing a new burst. DigestLowWatermark = 16 // DigestBurstSize is the number of Data packets to enqueue into crypto device. DigestBurstSize = 64 )
Variables ¶
var ( GqlPatternInput *graphql.InputObject GqlConfigInput *graphql.InputObject GqlPatternCountersType *graphql.Object GqlCountersType *graphql.Object GqlConsumerType *gqlserver.NodeType[*Consumer] )
GraphQL types.
var GqlRetrieveByFaceID func(id iface.ID) *Consumer
GqlRetrieveByFaceID returns *Consumer associated with a face. It is assigned during package tg initialization.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { RxQueue iface.PktQueueConfig `json:"rxQueue,omitempty"` // Interval defines average Interest interval. // TX thread transmits Interests in bursts, so the specified interval will be converted to // a burst interval with equivalent traffic amount. // Default is 1ms. Interval nnduration.Nanoseconds `json:"interval"` // Patterns defines traffic patterns. // It must contain between 1 and MaxPatterns entries. Patterns []Pattern `json:"patterns"` // contains filtered or unexported fields }
Config describes consumer configuration.
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represents a traffic generator consumer instance.
func (*Consumer) ClearCounters ¶
func (c *Consumer) ClearCounters()
ClearCounters clears counters. Both RX and TX threads should be stopped before calling this, otherwise race conditions may occur.
func (*Consumer) ConnectRxQueues ¶
func (c *Consumer) ConnectRxQueues(demuxD, demuxN *iface.InputDemux)
ConnectRxQueues connects Data+Nack InputDemux to RxQueues.
func (*Consumer) StopDelay ¶
StopDelay stops the TX thread, sleep for the specified duration, then stops the RX thread.
func (Consumer) Workers ¶
func (c Consumer) Workers() []ealthread.ThreadWithRole
Workers returns worker threads.
type Counters ¶
type Counters struct { PacketCounters NAllocError uint64 `json:"nAllocError"` Rtt runningstat.Snapshot `json:"rtt" gqldesc:"RTT in nanoseconds."` PerPattern []PatternCounters `json:"perPattern"` }
Counters contains consumer counters.
type PacketCounters ¶
type PacketCounters struct { NInterests uint64 `json:"nInterests"` NData uint64 `json:"nData"` NNacks uint64 `json:"nNacks"` }
PacketCounters is a group of network layer packet counters.
func (PacketCounters) DataRatio ¶
func (cnt PacketCounters) DataRatio() float64
DataRatio returns NData/NInterests.
func (PacketCounters) NackRatio ¶
func (cnt PacketCounters) NackRatio() float64
NackRatio returns NNacks/NInterests.
func (PacketCounters) String ¶
func (cnt PacketCounters) String() string
type Pattern ¶
type Pattern struct { // Weight of random choice, minimum/default is 1. Weight int `json:"weight,omitempty"` ndni.InterestTemplateConfig // If specified, append implicit digest to Interest name. // For Data to satisfy Interests, the producer pattern must reply with the same DataGenConfig. Digest *ndni.DataGenConfig `json:"digest,omitempty"` // If non-zero, request cached Data. This must appear after a pattern without SeqNumOffset. // The consumer derives sequence number by subtracting SeqNumOffset from the previous pattern's // sequence number. Sufficient CS capacity is necessary for Data to actually come from CS. SeqNumOffset int `json:"seqNumOffset,omitempty"` }
Pattern configures how the consumer generates a sequence of Interests.
type PatternCounters ¶
type PatternCounters struct { PacketCounters Rtt runningstat.Snapshot `json:"rtt" gqldesc:"RTT in nanoseconds."` }
PatternCounters contains per-pattern counters.
func (PatternCounters) String ¶
func (cnt PatternCounters) String() string