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