disk.go 1.2 KB
Newer Older
1
package gopsutil
W
WAKAYAMA Shirou 已提交
2

3 4 5 6
import (
	"encoding/json"
)

W
WAKAYAMA Shirou 已提交
7
type DiskUsageStat struct {
W
WAKAYAMA Shirou 已提交
8 9 10 11 12 13 14 15
	Path              string  `json:"path"`
	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"`
N
Nikolay Sivko 已提交
16
	InodesUsedPercent float64 `json:"inodesUsedPercent"`
W
WAKAYAMA Shirou 已提交
17 18
}

W
WAKAYAMA Shirou 已提交
19
type DiskPartitionStat struct {
20 21 22 23 24 25
	Device     string `json:"device"`
	Mountpoint string `json:"mountpoint"`
	Fstype     string `json:"fstype"`
	Opts       string `json:"opts"`
}

W
WAKAYAMA Shirou 已提交
26
type DiskIOCountersStat struct {
W
WAKAYAMA Shirou 已提交
27 28 29 30 31 32
	ReadCount  uint64 `json:"readCount"`
	WriteCount uint64 `json:"writeCount"`
	ReadBytes  uint64 `json:"readBytes"`
	WriteBytes uint64 `json:"writeBytes"`
	ReadTime   uint64 `json:"readTime"`
	WriteTime  uint64 `json:"writeTime"`
33
	Name       string `json:"name"`
34
	IoTime	   uint64 `json:"ioTime"`
W
WAKAYAMA Shirou 已提交
35
}
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

func (d DiskUsageStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

func (d DiskPartitionStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}

func (d DiskIOCountersStat) String() string {
	s, _ := json.Marshal(d)
	return string(s)
}