Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesPerSec ¶
type FakeATS ¶
func (FakeATS) MarshalJSON ¶
type FakeProcLoadAvg ¶
type FakeProcLoadAvg struct {
CPU1m float64
CPU5m float64
CPU10m float64
RunningProcs int
TotalProcs int
LastPIDUsed int
}
func (FakeProcLoadAvg) MarshalJSON ¶
func (p FakeProcLoadAvg) MarshalJSON() ([]byte, error)
type FakeProcNetDev ¶
type FakeProcNetDev struct {
Interface string
RcvBytes uint64
RcvPackets uint64
RcvErrs uint64
RcvDropped uint64
RcvFIFOErrs uint64
RcvFrameErrs uint64
RcvCompressed uint64
RcvMulticast uint64
SndBytes uint64
SndPackets uint64
SndErrs uint64
SndDropped uint64
SndFIFOErrs uint64
SndCollisions uint64
SndCarrierErrs uint64
SndCompressed uint64
}
func (FakeProcNetDev) MarshalJSON ¶
func (p FakeProcNetDev) MarshalJSON() ([]byte, error)
type FakeServerData ¶
type FakeServerData struct {
ATS FakeATS `json:"ats"`
System FakeSystem `json:"system"`
}
func (*FakeServerData) GetSystem ¶
func (s *FakeServerData) GetSystem() FakeServerSystem
GetSystem returns a FakeServerSystem, which can be serialized as the JSON response of Astats with an "application=system" query
type FakeServerSystem ¶
type FakeServerSystem struct {
ATS FakeSystemATS `json:"ats"`
System FakeSystem `json:"system"`
}
type FakeSystem ¶
type FakeSystem struct {
Name string `json:"inf.name"`
Speed int `json:"inf.speed"`
ProcNetDev FakeProcNetDev `json:"proc.net.dev"`
ProcLoadAvg FakeProcLoadAvg `json:"proc.loadavg"`
ConfgiReloadRequests uint64 `json:"configReloadRequests"`
LastReloadRequest uint64 `json:"lastReloadRequest"`
ConfigReloads uint64 `json:"configReloads"`
LastReload uint64 `json:"lastReload"`
AstatsLoad uint64 `json:"astatsLoad"`
Something string `json:"something"`
Version string `json:"application_version"`
}
type FakeSystemATS ¶
type FakeSystemATS struct {
Server string `json:"server"`
}
type IncrementChanT ¶
type IncrementChanT struct {
RemapName string
BytesPerSec BytesPerSec
}
type MinMaxUint64 ¶
type Ths ¶
type Ths struct {
// IncrementChan may be used to set the increments for a particular remap.
// Note this is not synchronized with GetIncrementChan, so multiple writers calling GetIncrementChan and IncrmeentChan to get and set will race, unless they are externally synchronized.
IncrementChan chan IncrementChanT
// GetIncrementsChan may be used to get the current increments for all remaps.
// The returned map must not be modified.
// Note this is not synchronized with GetIncrementChan, so multiple writers calling GetIncrementChan and IncrmeentChan to get and set will race, unless they are externally synchronized.
GetIncrementsChan chan map[string]BytesPerSec
// DelayMS is the minimum and maximum delay to serve requests, in milliseconds.
// Atomic - MUST be accessed with sync/atomic.LoadUintptr and sync/atomic.StoreUintptr.
DelayMS *unsafe.Pointer
// contains filtered or unexported fields
}
Ths provides threadsafe access to a ThsT pointer. Note the object itself is not safe for multiple access, and must not be mutated, either by the original owner after calling Set, or by future users who call Get. If you need to mutate, perform a deep copy.
func Run ¶
func Run(s FakeServerData, remapIncrements map[string]BytesPerSec) (Ths, error)
Run takes a FakeServerData and a config, and starts running it, incrementing stats per the config. Returns a Threadsafe accessor to the running FakeServerData pointer, whose value may be accessed, but MUST NOT be modified. TODO add increments for Rcv,SndPackets, ProcLoadAvg variance, ConfigReloads
type ThsT ¶
type ThsT *FakeServerData