github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/sys/cpu_darwin.go (about)

     1  // Package sys provides methods to read system information
     2  /*
     3   * Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package sys
     6  
     7  import (
     8  	"errors"
     9  
    10  	"github.com/lufia/iostat"
    11  )
    12  
    13  // Containerized returns true if the application is running
    14  // inside a container(docker/lxc/k8s)
    15  func isContainerized() bool { return false }
    16  
    17  // ContainerNumCPU returns the approximate number of CPUs allocated for the container.
    18  func containerNumCPU() (int, error) {
    19  	return 0, errors.New("cannot get container cpu stats")
    20  }
    21  
    22  // LoadAverage returns the system load average.
    23  func LoadAverage() (avg LoadAvg, err error) {
    24  	loadAvg, err := iostat.ReadLoadAvg()
    25  	if err != nil {
    26  		return avg, err
    27  	}
    28  	return LoadAvg{
    29  		One:     loadAvg.Load1,
    30  		Five:    loadAvg.Load5,
    31  		Fifteen: loadAvg.Load15,
    32  	}, nil
    33  }