benchmark

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogFile

func NewLogFile(name string, append bool, maxlogsize int64) *logFile

func NewWriter

func NewWriter(w io.Writer) *bufio.Writer

NewWriter returns a valid buffered StringWriter (bufio.Writer) based on w. The bufio.Writer interface implements Writer, StringWriter, ReadFrom, WriteByte, WriteRune, etc.

If w is nil, w is reassigned defaultBenchmarkOutput (os.Stdout).

This io.Writer is wrapped in a bufio.Writer and returned:

bufio.NewWriter(w)

(from bufio.Writer)

Writer implements buffering for an io.Writer object. If an error occurs writing to a Writer, no more data will be accepted and all subsequent writes, and Flush, will return the error. After all data has been written, the client should call the Flush method to guarantee all data has been forwarded to the underlying io.Writer.

func RunBenchmark

func RunBenchmark(b Benchmarks)

RunBenchmark initializes the benchmark and processes the given tests. Command line arguments may be passed when used in CLI mode.

Types

type Any

type Any = interface{}

type BenchmarkTestSet

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

BenchmarkTestSet is a collection of benchmark tests and configuration information. Allows each benchmark to have its own configuration settings.

Use <nil> for config to use parent configuration.

type Benchmarks

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

Benchmarks is a collection of test sets to run on the entire code base. This is the top level structure.

type ConfigSettings

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

func NewConfig

func NewConfig(verbose bool, out io.Writer, log *logFile, fmtString string) *ConfigSettings

type ResponseRecorder

type ResponseRecorder httptest.ResponseRecorder

func (*ResponseRecorder) Bytes

func (r *ResponseRecorder) Bytes() []byte

Bytes returns a slice of length b.Len() holding the unread portion of the buffer. If the buffer is empty, nil is returned.

The slice is valid for use only until the next buffer modification (that is, only until the next call to a method like Read, Write, Reset, or Truncate). The slice aliases the buffer content at least until the next buffer modification, so immediate changes to the slice will affect the result of future reads.

func (*ResponseRecorder) Read

func (r *ResponseRecorder) Read(p []byte) (n int, err error)

Read reads the next len(p) bytes from the buffer or until the buffer is drained. The return value n is the number of bytes read. If the buffer has no data to return, err is io.EOF (unless len(p) is zero); otherwise it is nil.

func (*ResponseRecorder) ReadString

func (r *ResponseRecorder) ReadString(delim byte) (line string, err error)

ReadString reads until the first occurrence of delim in the input, returning a string containing the data up to and including the delimiter. If ReadString encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). ReadString returns err != nil if and only if the returned data does not end in delim.

func (*ResponseRecorder) String

func (r *ResponseRecorder) String() string

String returns the contents of the unread portion of the buffer as a string. If the Buffer is a nil pointer, it returns "<nil>".

To build strings more efficiently, see the strings.Builder type.

func (*ResponseRecorder) Write

func (r *ResponseRecorder) Write(p []byte) (int, error)

Write appends the contents of p to the buffer, growing the buffer as needed. The return value n is the length of p; err is always nil. If the buffer becomes too large, Write will panic with ErrTooLarge.

func (*ResponseRecorder) WriteString

func (r *ResponseRecorder) WriteString(s string) (n int, err error)

WriteString appends the contents of s to the buffer, growing the buffer as needed. The return value n is the length of s; err is always nil. If the buffer becomes too large, WriteString will panic with ErrTooLarge.

Jump to

Keyboard shortcuts

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