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 10 11 12 13 14
var invoke common.Invoker

func init() {
	invoke = common.Invoke{}
}

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

28
type PartitionStat struct {
29 30 31 32 33 34
	Device     string `json:"device"`
	Mountpoint string `json:"mountpoint"`
	Fstype     string `json:"fstype"`
	Opts       string `json:"opts"`
}

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

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

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

61
func (d IOCountersStat) String() string {
62 63 64
	s, _ := json.Marshal(d)
	return string(s)
}