cmd/stbench: Add utility to run benchmark tests

This commit is contained in:
Jakob Borg
2016-03-25 20:52:20 +00:00
committed by Audrius Butkevicius
parent c58eb1d47a
commit f706d3c393
2 changed files with 192 additions and 0 deletions

View File

@@ -574,3 +574,52 @@ func (p *Process) Connections() (map[string]ConnectionStats, error) {
return res, nil
}
type SystemStatus struct {
Alloc int64
CPUPercent float64
Goroutines int
MyID protocol.DeviceID
PathSeparator string
StartTime time.Time
Sys int64
Themes []string
Tilde string
Uptime int
}
func (p *Process) SystemStatus() (SystemStatus, error) {
bs, err := p.Get("/rest/system/status")
if err != nil {
return SystemStatus{}, err
}
var res SystemStatus
if err := json.Unmarshal(bs, &res); err != nil {
return SystemStatus{}, err
}
return res, nil
}
type SystemVersion struct {
Arch string
Codename string
LongVersion string
OS string
Version string
}
func (p *Process) SystemVersion() (SystemVersion, error) {
bs, err := p.Get("/rest/system/version")
if err != nil {
return SystemVersion{}, err
}
var res SystemVersion
if err := json.Unmarshal(bs, &res); err != nil {
return SystemVersion{}, err
}
return res, nil
}