//go:build linux // +build linux package load import ( "context" "io/ioutil" "strconv" "strings" "syscall" "github.com/shirou/gopsutil/v3/internal/common" ) func Avg() (*AvgStat, error) { return AvgWithContext(context.Background()) } func AvgWithContext(ctx context.Context) (*AvgStat, error) { stat, err := fileAvgWithContext(ctx) if err != nil { stat, err = sysinfoAvgWithContext() } return stat, err } func sysinfoAvgWithContext() (*AvgStat, error) { var info syscall.Sysinfo_t err := syscall.Sysinfo(&info) if err != nil { return nil, err } const si_load_shift = 16 return &AvgStat{ Load1: float64(info.Loads[0]) / float64(1<