perfutil

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package perfutil contains utilities needed for VM performance testing.

Index

Constants

View Source
const ContainerHomeDir = "/home/testuser"

ContainerHomeDir is the default home directory for test user in container.

Variables

This section is empty.

Functions

func RunCmd

func RunCmd(ctx context.Context, cmd *testexec.Cmd, errWriter io.Writer) (out []byte, err error)

RunCmd runs cmd and returns its combined stdout and stderr. If an error is encountered, details are written to errWriter.

func ToTimeUnit

func ToTimeUnit(unit time.Duration, ts ...time.Duration) (out []float64)

ToTimeUnit returns time.Duration in unit as float64 numbers.

func WriteError

func WriteError(ctx context.Context, w io.Writer, title string, content []byte)

WriteError output errors to an io.Writer.

Types

type HostBinaryRunner

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

HostBinaryRunner runs a binary compiled for host in container. It is useful to ensure the same binary is used when the performance of the binary itself matters. This avoids performance gap introduced by different compiler/compiler flags/optimization level etc. It copies needed dynamic library and dynamic linker from host to container so the binary can be executed.

func NewHostBinaryRunner

func NewHostBinaryRunner(ctx context.Context, binary string, cont *vm.Container, errWriter io.Writer) (*HostBinaryRunner, error)

NewHostBinaryRunner creates a HostBinaryRunner object.

func (*HostBinaryRunner) Command

func (h *HostBinaryRunner) Command(ctx context.Context, args ...string) *testexec.Cmd

Command returns a command for executing the binary in the container with the supplied args.

Jump to

Keyboard shortcuts

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