Documentation ¶
Index ¶
- Variables
- type DeviceConfig
- func (dc *DeviceConfig) AllocateTime(numBytes units.NumBytes) time.Duration
- func (dc *DeviceConfig) ReadTime(numBytes units.NumBytes) time.Duration
- func (dc *DeviceConfig) ReadableBytes(duration time.Duration) units.NumBytes
- func (dc *DeviceConfig) String() string
- func (dc *DeviceConfig) Validate() error
- func (dc *DeviceConfig) WritableBytes(duration time.Duration) units.NumBytes
- func (dc *DeviceConfig) WriteTime(numBytes units.NumBytes) time.Duration
- type FsyncStrategy
- type WriteStrategy
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var HDD7200RpmDeviceConfig = DeviceConfig{ Name: "hdd7200rpm", SeekWindow: 4 * units.Kibibyte, SeekTime: 10 * time.Millisecond, ReadBytesPerSecond: 100 * units.Mebibyte, WriteBytesPerSecond: 100 * units.Mebibyte, AllocateBytesPerSecond: 4096 * 100 * units.Mebibyte, RequestReorderMaxDelay: 100 * time.Microsecond, FsyncStrategy: WriteBackCachedFsync, WriteStrategy: FastWrite, MetadataOpTime: 10 * time.Millisecond, }
HDD7200RpmDeviceConfig is a basic model of a 7200rpm hard disk.
Functions ¶
This section is empty.
Types ¶
type DeviceConfig ¶
type DeviceConfig struct { // Name is the name of this configuration. This is used for selecting on the command line which // configuration to use. Name string // SeekWindow describes how many bytes ahead in a file we can access before considering // it a seek. SeekWindow units.NumBytes // SeekTime denotes the average time of a seek. SeekTime time.Duration // ReadBytesPerSecond denotes how many bytes we can read per second. ReadBytesPerSecond units.NumBytes // ReadBytesPerSecond denotes how many bytes we can write per second. WriteBytesPerSecond units.NumBytes // AllocateBytesPerSecond denotes how many bytes we can allocate using // fallocate per second. AllocateBytesPerSecond units.NumBytes // RequestReorderMaxDelay denotes how much later a request can be by timestamp after a previous // one and still be reordered before it. RequestReorderMaxDelay time.Duration // FsyncStrategy denotes which algorithm to use for modeling fsync. FsyncStrategy FsyncStrategy // WriteStrategy denotes which algorithm to use for modeling writes. WriteStrategy WriteStrategy // MetadataOpTime denotes how long metadata operations (like chmod, chown, etc) should take. MetadataOpTime time.Duration }
DeviceConfig is used to describe how a physical medium acts (e.g. rotational hard drive).
func ParseDeviceConfigsFromJSON ¶
func ParseDeviceConfigsFromJSON(data []byte) ([]*DeviceConfig, error)
ParseDeviceConfigsFromJSON parses json containing an array of device configs.
func (*DeviceConfig) AllocateTime ¶
func (dc *DeviceConfig) AllocateTime(numBytes units.NumBytes) time.Duration
AllocateTime computes how long allocating numBytes will take.
func (*DeviceConfig) ReadTime ¶
func (dc *DeviceConfig) ReadTime(numBytes units.NumBytes) time.Duration
ReadTime computes how long reading numBytes will take.
func (*DeviceConfig) ReadableBytes ¶
func (dc *DeviceConfig) ReadableBytes(duration time.Duration) units.NumBytes
ReadableBytes computes how many bytes can be read in the given duration.
func (*DeviceConfig) String ¶
func (dc *DeviceConfig) String() string
Example ¶
n := DeviceConfig{ Name: "example", SeekWindow: 4 * units.Kibibyte, SeekTime: 10 * time.Millisecond, ReadBytesPerSecond: 100 * units.Mebibyte, WriteBytesPerSecond: 100 * units.Mebibyte, AllocateBytesPerSecond: 4096 * 100 * units.Mebibyte, RequestReorderMaxDelay: 100 * time.Microsecond, FsyncStrategy: WriteBackCachedFsync, WriteStrategy: FastWrite, MetadataOpTime: 10 * time.Millisecond, } fmt.Println(n.String())
Output: example: SeekWindow 4.10KB (4096) SeekTime 10ms ReadBytesPerSecond 104.86MB (104857600) WriteBytesPerSecond 104.86MB (104857600) AllocateBytesPerSecond 429.50GB (429496729600) RequestReorderMaxDelay 100µs FsyncStrategy WriteBackCachedFsync WriteStrategy FastWrite MetadataOpTime 10ms
func (*DeviceConfig) Validate ¶
func (dc *DeviceConfig) Validate() error
Validate decides whether a device config is valid or not. If a device config has fields that don't make sense (like negative delays), it will return an error. If there are field combinations that /probably/ don't make sense it will print a warning message.
func (*DeviceConfig) WritableBytes ¶
func (dc *DeviceConfig) WritableBytes(duration time.Duration) units.NumBytes
WritableBytes computes how many bytes can be written in the given duration.
type FsyncStrategy ¶
type FsyncStrategy int
FsyncStrategy indicates which strategy to use for fsync simulation.
const ( // NoFsync indicates a strategy where fsync takes zero time. NoFsync FsyncStrategy = iota // DumbFsync indicates a strategy where fsync takes ten seek times (chosen arbitrarily). DumbFsync // WriteBackCachedFsync indicates a simulation of write back cache. This means writes will take // very little time, and writing back that data to disk will be simulated to happen during spare // IO time. When fsync is called on a file, how much unwritten data remaining for that file // determines how long the fsync takes. WriteBackCachedFsync )
func ParseFsyncStrategyFromString ¶
func ParseFsyncStrategyFromString(s string) (FsyncStrategy, error)
ParseFsyncStrategyFromString parses a FsyncStrategy from a string. There can be multiple ways to specify each FsyncStrategy (e.g. nofsync, none, and no all mean 'NoFsync'). This function is case insensitive.
func (FsyncStrategy) String ¶
func (f FsyncStrategy) String() string
type WriteStrategy ¶
type WriteStrategy int
WriteStrategy indicates which strategy to use for write simulation.
const ( // FastWrite means writes will take zero time, as if they were cached. // Useful in conjunction with WriteBackCachedFsync FastWrite WriteStrategy = iota // SimulateWrite means writes will act in the same way as reads -- that is, // seeking if non-sequential, and being written out at the speed specified // by WriteBytesPerSecond. SimulateWrite )
func ParseWriteStrategyFromString ¶
func ParseWriteStrategyFromString(s string) (WriteStrategy, error)
ParseWriteStrategyFromString parses a WriteStrategy from the given string. This function is case insensitive, and also accepts synonyms for each WriteStrategy. For example, fastwrite and fast both map to the FastWrite strategy.
func (WriteStrategy) String ¶
func (w WriteStrategy) String() string
Directories ¶
Path | Synopsis |
---|---|
Package fuselayer contains the go-fuse handling code.
|
Package fuselayer contains the go-fuse handling code. |
Package scheduler provides the scheduler, which takes requests of particular types (e.g.
|
Package scheduler provides the scheduler, which takes requests of particular types (e.g. |