Documentation ¶
Overview ¶
Package netperf is used for running performance tests using linux netperf/netserver suite. Example usage: netperfSession := netperf.NewSession(
clientHost.conn, clientHost.IP, // DUT IP serverHost.conn, serverHost.IP) // Router IP
defer func(ctx context.Context) { netperfSession.Close(ctx) }(ctx)
ret, err = netperfSession.Run(ctx, netperf.Config{ TestTime: 10*time.Second, TestType: netperf.TestTypeTCPStream})
Index ¶
Constants ¶
const ( // TestTypeTCPCRR measures how many times we can connect, request a byte, // and receive a byte per second. TestTypeTCPCRR TestType = "TCP_CRR" // TestTypeTCPMaerts : maerts is stream backwards. Like TCP_STREAM, except // it measures stream's bitrate in opposite direction: from the netperf server // to the client. TestTypeTCPMaerts = "TCP_MAERTS" // TestTypeTCPRR measures how many times we can request a byte and receive // a byte per second. TestTypeTCPRR = "TCP_RR" // TestTypeTCPSendfile is like a TCP_STREAM test except that the netperf client // will use a platform dependent call like sendfile() rather than the simple // send() call. This can result in better performance. TestTypeTCPSendfile = "TCP_SENDFILE" // TestTypeTCPStream measures throughput sending bytes from the client // to the server in a TCP stream. TestTypeTCPStream = "TCP_STREAM" // TestTypeUDPRR measures how many times we can request a byte from the client // and receive a byte from the server. If any datagram is dropped, the client // or server will block indefinitely. This failure is not evident except // as a low transaction rate. TestTypeUDPRR = "UDP_RR" // TestTypeUDPStream tests UDP throughput sending from the client to the server. // There is no flow control here, and generally sending is easier that receiving, // so there will be two types of throughput, both receiving and sending. TestTypeUDPStream = "UDP_STREAM" // TestTypeUDPMaerts isn't a real test type, but we can emulate a UDP stream // from the server to the DUT by running the netperf server on the DUT and the // client on the server and then doing a UDP_STREAM test. TestTypeUDPMaerts = "UDP_MAERTS" )
const ( // CategoryThroughput measures throughput in Mbps. CategoryThroughput Category = "throughput" // CategoryTransactionRate measures transaction rate per s. CategoryTransactionRate = "transaction rate" // CategoryErrors measures transmission errors. CategoryErrors = "errors" // CategoryThroughputDev st. deviation of throughput. CategoryThroughputDev = "throughput dev" // CategoryTransactionRateDev st. deviation of transaction rate. CategoryTransactionRateDev = "transaction rate dev" // CategoryErrorsDev st. deviation of errors. CategoryErrorsDev = "errors dev" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category string
Category is a measurement category, used as the key in measurements map. Its value is also used as a human-readable tag.
type Config ¶
type Config struct { // TestTime how long the test should be run. TestTime time.Duration // TestType is literally this: test type. TestType TestType // Reverse: reverse client and server roles. Reverse bool }
Config defines configuration for netperf run.
func (*Config) HumanReadableTag ¶
HumanReadableTag returns human readable tag describing the configuration.
type Result ¶
type Result struct { TestType TestType Duration time.Duration // Measurements: throughput, transactionRate, errors or their st.deviations. Measurements map[Category]float64 }
Result is used to carry either single result or its derivative (mean/st.dev).
func AggregateSamples ¶
AggregateSamples creates aggregate result out of slice of results
type RunnerHost ¶
type RunnerHost struct {
// contains filtered or unexported fields
}
RunnerHost defines host's IP and SSH connection.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session contains session data for running Runner.
func NewSession ¶
func NewSession( clientConn *ssh.Conn, clientIP string, serverConn *ssh.Conn, serverIP string) *Session
NewSession creates a new netperf session. In each session, various tests with different configurations can be run.