disk.go 1.6 KB
Newer Older
S
Shirou WAKAYAMA 已提交
1
package disk
W
WAKAYAMA Shirou 已提交
2

3 4
import (
	"encoding/json"
5 6

	"github.com/shirou/gopsutil/internal/common"
7 8
)

9
var invoke common.Invoker = common.Invoke{}
10

11
type UsageStat struct {
W
WAKAYAMA Shirou 已提交
12
	Path              string  `json:"path"`
13
	Fstype            string  `json:"fstype"`
W
WAKAYAMA Shirou 已提交
14 15 16
	Total             uint64  `json:"total"`
	Free              uint64  `json:"free"`
	Used              uint64  `json:"used"`
17 18 19 20 21
	UsedPercent       float64 `json:"usedPercent"`
	InodesTotal       uint64  `json:"inodesTotal"`
	InodesUsed        uint64  `json:"inodesUsed"`
	InodesFree        uint64  `json:"inodesFree"`
	InodesUsedPercent float64 `json:"inodesUsedPercent"`
W
WAKAYAMA Shirou 已提交
22 23
}

24
type PartitionStat struct {
25 26 27 28 29 30
	Device     string `json:"device"`
	Mountpoint string `json:"mountpoint"`
	Fstype     string `json:"fstype"`
	Opts       string `json:"opts"`
}

31
type IOCountersStat struct {
32 33 34 35 36 37 38 39 40 41
	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"`
42
	WeightedIO       uint64 `json:"weightedIO"`
43 44
	Name             string `json:"name"`
	SerialNumber     string `json:"serialNumber"`
W
WAKAYAMA Shirou 已提交
45
}
46

47
func (d UsageStat) String() string {
48 49 50 51
	s, _ := json.Marshal(d)
	return string(s)
}

52
func (d PartitionStat) String() string {
53 54 55 56
	s, _ := json.Marshal(d)
	return string(s)
}

57
func (d IOCountersStat) String() string {
58 59 60
	s, _ := json.Marshal(d)
	return string(s)
}