2016-05-22 10:46:49 +00:00
|
|
|
package disk
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/shirou/gopsutil/internal/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
var invoke common.Invoker
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
invoke = common.Invoke{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type UsageStat struct {
|
|
|
|
Path string `json:"path"`
|
|
|
|
Fstype string `json:"fstype"`
|
|
|
|
Total uint64 `json:"total"`
|
|
|
|
Free uint64 `json:"free"`
|
|
|
|
Used uint64 `json:"used"`
|
|
|
|
UsedPercent float64 `json:"usedPercent"`
|
|
|
|
InodesTotal uint64 `json:"inodesTotal"`
|
|
|
|
InodesUsed uint64 `json:"inodesUsed"`
|
|
|
|
InodesFree uint64 `json:"inodesFree"`
|
|
|
|
InodesUsedPercent float64 `json:"inodesUsedPercent"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PartitionStat struct {
|
|
|
|
Device string `json:"device"`
|
|
|
|
Mountpoint string `json:"mountpoint"`
|
|
|
|
Fstype string `json:"fstype"`
|
|
|
|
Opts string `json:"opts"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type IOCountersStat struct {
|
2016-08-30 17:48:07 +00:00
|
|
|
ReadCount uint64 `json:"readCount"`
|
|
|
|
MergedReadCount uint64 `json:"mergedReadCount"`
|
|
|
|
WriteCount uint64 `json:"writeCount"`
|
|
|
|
MergedWriteCount uint64 `json:"mergedWriteCount"`
|
|
|
|
ReadBytes uint64 `json:"readBytes"`
|
|
|
|
WriteBytes uint64 `json:"writeBytes"`
|
|
|
|
ReadTime uint64 `json:"readTime"`
|
|
|
|
WriteTime uint64 `json:"writeTime"`
|
|
|
|
IopsInProgress uint64 `json:"iopsInProgress"`
|
|
|
|
IoTime uint64 `json:"ioTime"`
|
2017-02-02 06:41:29 +00:00
|
|
|
WeightedIO uint64 `json:"weightedIO"`
|
2016-08-30 17:48:07 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
SerialNumber string `json:"serialNumber"`
|
2016-05-22 10:46:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d UsageStat) String() string {
|
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d PartitionStat) String() string {
|
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d IOCountersStat) String() string {
|
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|