2014-12-30 21:09:05 +08:00
|
|
|
package disk
|
2014-04-18 15:34:47 +08:00
|
|
|
|
2014-05-01 17:43:11 +08:00
|
|
|
import (
|
|
|
|
"encoding/json"
|
2016-05-20 16:59:41 +08:00
|
|
|
|
|
|
|
"github.com/shirou/gopsutil/internal/common"
|
2014-05-01 17:43:11 +08:00
|
|
|
)
|
|
|
|
|
2018-03-21 22:08:39 +08:00
|
|
|
var invoke common.Invoker = common.Invoke{}
|
2016-05-20 16:59:41 +08:00
|
|
|
|
2016-03-22 22:09:12 +08:00
|
|
|
type UsageStat struct {
|
2014-08-26 21:17:35 +08:00
|
|
|
Path string `json:"path"`
|
2015-08-14 17:08:43 +08:00
|
|
|
Fstype string `json:"fstype"`
|
2014-08-26 21:17:35 +08:00
|
|
|
Total uint64 `json:"total"`
|
|
|
|
Free uint64 `json:"free"`
|
|
|
|
Used uint64 `json:"used"`
|
2016-03-23 09:52:46 +08:00
|
|
|
UsedPercent float64 `json:"usedPercent"`
|
|
|
|
InodesTotal uint64 `json:"inodesTotal"`
|
|
|
|
InodesUsed uint64 `json:"inodesUsed"`
|
|
|
|
InodesFree uint64 `json:"inodesFree"`
|
|
|
|
InodesUsedPercent float64 `json:"inodesUsedPercent"`
|
2014-04-18 15:34:47 +08:00
|
|
|
}
|
|
|
|
|
2016-03-22 22:09:12 +08:00
|
|
|
type PartitionStat 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"`
|
|
|
|
}
|
|
|
|
|
2016-03-22 22:09:12 +08:00
|
|
|
type IOCountersStat struct {
|
2016-08-16 15:14:45 +08: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"`
|
2016-09-22 05:48:49 +08:00
|
|
|
WeightedIO uint64 `json:"weightedIO"`
|
2016-08-16 15:14:45 +08:00
|
|
|
Name string `json:"name"`
|
|
|
|
SerialNumber string `json:"serialNumber"`
|
2018-04-27 06:27:15 +08:00
|
|
|
Label string `json:"label"`
|
2014-04-18 15:34:47 +08:00
|
|
|
}
|
2014-05-01 17:43:11 +08:00
|
|
|
|
2016-03-22 22:09:12 +08:00
|
|
|
func (d UsageStat) String() string {
|
2014-05-01 17:43:11 +08:00
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|
|
|
|
|
2016-03-22 22:09:12 +08:00
|
|
|
func (d PartitionStat) String() string {
|
2014-05-01 17:43:11 +08:00
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|
|
|
|
|
2016-03-22 22:09:12 +08:00
|
|
|
func (d IOCountersStat) String() string {
|
2014-05-01 17:43:11 +08:00
|
|
|
s, _ := json.Marshal(d)
|
|
|
|
return string(s)
|
|
|
|
}
|