2014-04-22 08:44:22 +08:00
|
|
|
package gopsutil
|
2014-04-18 15:34:47 +08:00
|
|
|
|
2014-05-01 17:43:11 +08:00
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
)
|
|
|
|
|
2014-04-30 14:32:05 +08:00
|
|
|
type DiskUsageStat struct {
|
2014-04-19 23:03:47 +08:00
|
|
|
Path string `json:"path"`
|
|
|
|
Total uint64 `json:"total"`
|
|
|
|
Free uint64 `json:"free"`
|
|
|
|
Used uint64 `json:"used"`
|
|
|
|
UsedPercent float64 `json:"usedPercent"`
|
2014-04-18 15:34:47 +08:00
|
|
|
}
|
|
|
|
|
2014-04-30 14:32:05 +08:00
|
|
|
type DiskPartitionStat struct {
|
2014-04-20 00:53:34 +08:00
|
|
|
Device string `json:"device"`
|
|
|
|
Mountpoint string `json:"mountpoint"`
|
|
|
|
Fstype string `json:"fstype"`
|
|
|
|
Opts string `json:"opts"`
|
|
|
|
}
|
|
|
|
|
2014-04-30 14:32:05 +08:00
|
|
|
type DiskIOCountersStat struct {
|
2014-04-18 15:34:47 +08:00
|
|
|
ReadCount uint64 `json:"readCount"`
|
|
|
|
WriteCount uint64 `json:"writeCount"`
|
|
|
|
ReadBytes uint64 `json:"readBytes"`
|
|
|
|
WriteBytes uint64 `json:"writeBytes"`
|
|
|
|
ReadTime uint64 `json:"readTime"`
|
|
|
|
WriteTime uint64 `json:"writeTime"`
|
2014-04-29 13:59:22 +08:00
|
|
|
Name string `json:"name"`
|
2014-04-18 15:34:47 +08:00
|
|
|
}
|
2014-05-01 17:43:11 +08:00
|
|
|
|
|
|
|
func (d DiskUsageStat) String() string {
|
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d DiskPartitionStat) String() string {
|
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d DiskIOCountersStat) String() string {
|
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|