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 ¶
- func Compare(w io.Writer, base, other Report) error
- func Names() []string
- func PrepareDir(dir string, subdir bool) (string, func() error, error)
- type Config
- type FS
- type Host
- type OS
- func (OS) Create(path string, data []byte) error
- func (OS) FSType(dir string) (string, error)
- func (OS) Lstat(path string) (fs.FileInfo, error)
- func (OS) Mkdir(path string) error
- func (OS) ReadDir(path string) ([]fs.DirEntry, error)
- func (OS) ReadFile(path string) ([]byte, error)
- func (OS) Remove(path string) error
- func (OS) RemoveAll(path string) error
- func (OS) Rename(oldPath, newPath string) error
- func (OS) Sync() error
- func (OS) WriteSync(path string, chunk []byte, chunks int) error
- type OpStat
- type Options
- type Report
- type Run
- type WorkloadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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 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 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 ¶
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 ¶
type Run ¶
type Run struct {
FSType string `json:"fs_type"`
Workloads []WorkloadResult `json:"workloads"`
}
type WorkloadResult ¶
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.