bench

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Blocksize = 0x1 << 16 // 65,536 bytes, 2^16 bytes

Variables

This section is empty.

Functions

func ClearBufferCacheEveryThreeSeconds

func ClearBufferCacheEveryThreeSeconds() error

the following should be run as a goroutine as part of the benchmark; clears the buffer cache every 3 seconds

func IOPS

func IOPS(operations int, duration time.Duration) float64

func MegaBytesPerSecond

func MegaBytesPerSecond(bytes int, duration time.Duration) float64

Types

type Mark

type Mark struct {
	Start                       time.Time `json:"start_time"`
	TempDir                     string    `json:"temp_dir"`
	AggregateTestFilesSizeInGiB float64   `json:"disk_space_used_gib"`
	NumReadersWriters           int       `json:"num_readers_and_writers"`
	PhysicalMemory              uint64    `json:"physical_memory_bytes"`
	IODuration                  float64   `json:"iops_duration_seconds"`
	Results                     []Result  `json:"results"`
	// contains filtered or unexported fields
}

bench.Mark{} -- haha! Get it? "benchmark"!

func (*Mark) CreateRandomBlock

func (bm *Mark) CreateRandomBlock() error

func (Mark) MarshalJSON

func (bm Mark) MarshalJSON() ([]byte, error)

Thanks Choly! http://choly.ca/post/go-json-marshalling/

func (*Mark) RunIOPSTest

func (bm *Mark) RunIOPSTest() error

func (*Mark) RunSequentialReadTest

func (bm *Mark) RunSequentialReadTest() error

ReadTest must be called before IOPSTest otherwise ReadTest will mistake IOPSTest's random writes for file corruption

func (*Mark) RunSequentialWriteTest

func (bm *Mark) RunSequentialWriteTest() error

the Sequential Write test must be called before the other two tests, for it creates the files

func (*Mark) SetTempDir

func (bm *Mark) SetTempDir(parentDir string) error

calling program should `defer os.RemoveAll(bm.TempDir)` to clean up after run

func (*Mark) Version

func (bm *Mark) Version() string

type Result

type Result struct {
	Start           time.Time     `json:"start_time"`
	WrittenBytes    int           `json:"write_bytes"`
	WrittenDuration time.Duration `json:"write_seconds"`
	ReadBytes       int           `json:"read_bytes"`
	ReadDuration    time.Duration `json:"read_seconds"`
	IOOperations    int           `json:"io_operations"`
	IODuration      time.Duration `json:"io_seconds"`
}

func (Result) MarshalJSON

func (r Result) MarshalJSON() ([]byte, error)

type ThreadResult

type ThreadResult struct {
	Result int // bytes written, bytes read, or number of I/O operations
	Error  error
}

Jump to

Keyboard shortcuts

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