gopsutil: github.com/yhat/gopsutil/cpu Index | Files

package cpu

import "github.com/yhat/gopsutil/cpu"

Index

Package Files

cpu.go cpu_linux.go cpu_unix.go

func CPUCounts Uses

func CPUCounts(logical bool) (int, error)

func CPUInfo Uses

func CPUInfo() ([]CPUInfoStat, error)

CPUInfo on linux will return 1 item per physical thread.

CPUs have three levels of counting: sockets, cores, threads. Cores with HyperThreading count as having 2 threads per core. Sockets often come with many physical CPU cores. For example a single socket board with two cores each with HT will return 4 CPUInfoStat structs on Linux and the "Cores" field set to 1.

func CPUPercent Uses

func CPUPercent(interval time.Duration, percpu bool) ([]float64, error)

func CPUTimes Uses

func CPUTimes(percpu bool) ([]CPUTimesStat, error)

type CPUInfoStat Uses

type CPUInfoStat struct {
    CPU        int32    `json:"cpu"`
    VendorID   string   `json:"vendor_id"`
    Family     string   `json:"family"`
    Model      string   `json:"model"`
    Stepping   int32    `json:"stepping"`
    PhysicalID string   `json:"physical_id"`
    CoreID     string   `json:"core_id"`
    Cores      int32    `json:"cores"`
    ModelName  string   `json:"model_name"`
    Mhz        float64  `json:"mhz"`
    CacheSize  int32    `json:"cache_size"`
    Flags      []string `json:"flags"`
}

func (CPUInfoStat) String Uses

func (c CPUInfoStat) String() string

type CPUTimesStat Uses

type CPUTimesStat struct {
    CPU       string  `json:"cpu"`
    User      float64 `json:"user"`
    System    float64 `json:"system"`
    Idle      float64 `json:"idle"`
    Nice      float64 `json:"nice"`
    Iowait    float64 `json:"iowait"`
    Irq       float64 `json:"irq"`
    Softirq   float64 `json:"softirq"`
    Steal     float64 `json:"steal"`
    Guest     float64 `json:"guest"`
    GuestNice float64 `json:"guest_nice"`
    Stolen    float64 `json:"stolen"`
}

func (CPUTimesStat) String Uses

func (c CPUTimesStat) String() string

Package cpu imports 9 packages (graph) and is imported by 2 packages. Updated 2017-02-01. Refresh now. Tools for package owners.