disk.go 1.4 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
	ReadCount    uint64 `json:"readCount"`
	WriteCount   uint64 `json:"writeCount"`
	ReadBytes    uint64 `json:"readBytes"`
	WriteBytes   uint64 `json:"writeBytes"`
	ReadTime     uint64 `json:"readTime"`
	WriteTime    uint64 `json:"writeTime"`
42
	Name         string `json:"name"`
43 44
	IoTime       uint64 `json:"ioTime"`
	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)
}