MCPcopy Index your code
hub / github.com/koding/kite / diskStats

Function diskStats

systeminfo/systeminfo_unix.go:7–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import "syscall"
6
7func diskStats() (*disk, error) {
8 d := new(disk)
9 stat := new(syscall.Statfs_t)
10
11 if err := syscall.Statfs("/", stat); err != nil {
12 return nil, err
13 }
14
15 bsize := stat.Bsize / 512
16
17 d.Total = (uint64(stat.Blocks) * uint64(bsize)) >> 1
18 free := (uint64(stat.Bfree) * uint64(bsize)) >> 1
19 d.Usage = d.Total - free
20
21 return d, nil
22}

Callers 1

NewFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected