package perf

import "github.com/Azure/azure-sdk-for-go/sdk/internal/perf"

Index

Functions

func NewRandomStream

func NewRandomStream(length int) (io.ReadSeekCloser, error)

func Run

func Run(tests map[string]PerfMethods)

Run runs an individual test, registers, and parses command line flags

Types

type GlobalPerfTest

type GlobalPerfTest interface {
	// NewPerfTest creates an instance of a PerfTest for each goroutine.
	NewPerfTest(context.Context, *PerfTestOptions) (PerfTest, error)

	// GlobalCleanup is run one time per performance test, as the final method.
	GlobalCleanup(context.Context) error
}

GlobalPerfTest methods execute once per process

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is the same interface as azcore.Transporter

type NewPerfTest

type NewPerfTest func(context.Context, PerfTestOptions) (GlobalPerfTest, error)

NewPerfTest returns an instance of PerfTest and embeds the given `options` in the struct

type PerfMethods

type PerfMethods struct {
	Register func()
	New      func(context.Context, PerfTestOptions) (GlobalPerfTest, error)
}

PerfMethods is the struct given to the Run method.

type PerfTest

type PerfTest interface {
	// Run is the function that is being measured.
	Run(context.Context) error

	// Cleanup is run once for each parallel instance.
	Cleanup(context.Context) error
}

PerfTest methods once per goroutine

type PerfTestOptions

type PerfTestOptions struct {
	// Transporter is the azcore.Transporter instance used for sending requests.
	Transporter HTTPClient

	// Name is the name of an individual test
	Name string
	// contains filtered or unexported fields
}

PerfTestOptions are the options for a performance test. Name and Transporter can be used by an individual performance test.

type RecordingHTTPClient

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

func NewProxyTransport

func NewProxyTransport(options *TransportOptions) *RecordingHTTPClient

NewRecordingHTTPClient returns a type that implements `azcore.Transporter`. This will automatically route tests on the `Do` call.

func (RecordingHTTPClient) Do

func (*RecordingHTTPClient) SetMode

func (c *RecordingHTTPClient) SetMode(mode string)

Change the recording mode

type TransportOptions

type TransportOptions struct {
	TestName string
	// contains filtered or unexported fields
}

Source Files

implementation.go perf.go perf_runner.go random_stream.go recording.go

Version
v1.10.0
Published
Jul 16, 2024
Platform
darwin/amd64
Imports
23 packages
Last checked
4 minutes ago

Tools for package owners.