fsbench

package
v0.45.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fsbench times file system workloads on any directory, so that a plain directory, a mount and a workspace give comparable numbers. Each workload checks its own result and fails on a mismatch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(w io.Writer, base, other Report) error

func Names

func Names() []string

func PrepareDir

func PrepareDir(dir string, subdir bool) (string, func() error, error)

PrepareDir returns the directory to run in and a function that removes what the run created. With subdir it makes a fresh subdirectory of dir; without, dir must be empty.

Types

type Config

type Config struct {
	Files        int `json:"files"`
	PayloadBytes int `json:"payload_bytes"`
	Depth        int `json:"depth"`
	Fanout       int `json:"fanout"`
	LargeMiB     int `json:"large_mib"`
	SyncWrites   int `json:"sync_writes"`
	SyncReps     int `json:"sync_reps"`
}

func DefaultConfig

func DefaultConfig() Config

func (Config) Validate

func (c Config) Validate() error

type FS

type FS interface {
	Mkdir(path string) error
	Create(path string, data []byte) error
	Lstat(path string) (fs.FileInfo, error)
	ReadFile(path string) ([]byte, error)
	ReadDir(path string) ([]fs.DirEntry, error)
	Rename(oldPath, newPath string) error
	Remove(path string) error
	RemoveAll(path string) error
	WriteSync(path string, chunk []byte, chunks int) error
	Sync() error
	FSType(dir string) (string, error)
}

type Host

type Host struct {
	OS        string `json:"os"`
	OSVersion string `json:"os_version"`
	Arch      string `json:"arch"`
	GoVersion string `json:"go_version"`
	FSType    string `json:"fs_type"`
}

type OS

type OS struct{}

func (OS) Create

func (OS) Create(path string, data []byte) error

func (OS) FSType

func (OS) FSType(dir string) (string, error)

func (OS) Lstat

func (OS) Lstat(path string) (fs.FileInfo, error)

func (OS) Mkdir

func (OS) Mkdir(path string) error

func (OS) ReadDir

func (OS) ReadDir(path string) ([]fs.DirEntry, error)

func (OS) ReadFile

func (OS) ReadFile(path string) ([]byte, error)

func (OS) Remove

func (OS) Remove(path string) error

func (OS) RemoveAll

func (OS) RemoveAll(path string) error

func (OS) Rename

func (OS) Rename(oldPath, newPath string) error

func (OS) Sync

func (OS) Sync() error

func (OS) WriteSync

func (OS) WriteSync(path string, chunk []byte, chunks int) error

type OpStat

type OpStat struct {
	Op        string  `json:"op"`
	Count     int     `json:"count"`
	TotalNS   int64   `json:"total_ns"`
	MeanNS    int64   `json:"mean_ns"`
	P50NS     int64   `json:"p50_ns"`
	P95NS     int64   `json:"p95_ns"`
	P99NS     int64   `json:"p99_ns"`
	MaxNS     int64   `json:"max_ns"`
	OpsPerSec float64 `json:"ops_per_sec"`
	Entries   int     `json:"entries,omitempty"`
	MBPerSec  float64 `json:"mb_per_sec,omitempty"`
	SamplesNS []int64 `json:"samples_ns,omitempty"`
}

type Options

type Options struct {
	Workloads []string
	Runs      int
	Warmup    int
	Label     string
	FSType    string
	Config    Config
}

type Report

type Report struct {
	Label   string    `json:"label"`
	Started time.Time `json:"started"`
	Host    Host      `json:"host"`
	Config  Config    `json:"config"`
	Runs    []Run     `json:"runs"`
}

func Measure

func Measure(fsys FS, dir string, o Options) (Report, error)

Measure runs the workloads Warmup times without keeping the result, then Runs times. The file system type of dir must stay the one at the start, or FSType when set.

func ReadReport

func ReadReport(path string) (Report, error)

func (Report) WriteTable

func (r Report) WriteTable(w io.Writer) error

type Run

type Run struct {
	FSType    string           `json:"fs_type"`
	Workloads []WorkloadResult `json:"workloads"`
}

type WorkloadResult

type WorkloadResult struct {
	Workload string   `json:"workload"`
	Ops      []OpStat `json:"ops"`
}

func RunOnce

func RunOnce(fsys FS, dir string, names []string, cfg Config, wantFS string) ([]WorkloadResult, error)

RunOnce runs each named workload in a new subdirectory of dir and removes it afterwards. A non-empty wantFS makes the run fail when the file system type of dir differs before or after a workload.

Directories

Path Synopsis
cmd
fsbench command
Command fsbench measures file system workloads on a directory.
Command fsbench measures file system workloads on a directory.

Jump to

Keyboard shortcuts

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