package stats import ( "time" "linkfog.com/public/lib/cgroup" "linkfog.com/public/lib/cgroup/fs" "linkfog.com/public/lib/cgroup/fs2" "linkfog.com/public/lib/cgroup/types" ) func GetIOStats(cgroupDir string) (*types.IOStats, error) { var stats map[string]*types.IOStat var err error if cgroup.IsCgroup2() { stats, err = fs2.GetAllDevIOStat(cgroupDir) } else { stats, err = fs.GetAllDevIOStat(cgroupDir) } if err != nil { return nil, err } return &types.IOStats{Stats: stats, Timestamp: time.Now()}, nil }