github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/pkg/api/handlers/compat/types.go (about)

     1  package compat
     2  
     3  import (
     4  	"time"
     5  
     6  	docker "github.com/docker/docker/api/types"
     7  )
     8  
     9  // CPUStats aggregates and wraps all CPU related info of container
    10  type CPUStats struct {
    11  	// CPU Usage. Linux and Windows.
    12  	CPUUsage docker.CPUUsage `json:"cpu_usage"`
    13  
    14  	// System Usage. Linux only.
    15  	SystemUsage uint64 `json:"system_cpu_usage,omitempty"`
    16  
    17  	// Online CPUs. Linux only.
    18  	OnlineCPUs uint32 `json:"online_cpus,omitempty"`
    19  
    20  	// Usage of CPU in %. Linux only.
    21  	CPU float64 `json:"cpu"`
    22  
    23  	// Throttling Data. Linux only.
    24  	ThrottlingData docker.ThrottlingData `json:"throttling_data,omitempty"`
    25  }
    26  
    27  // Stats is Ultimate struct aggregating all types of stats of one container
    28  type Stats struct {
    29  	// Common stats
    30  	Read    time.Time `json:"read"`
    31  	PreRead time.Time `json:"preread"`
    32  
    33  	// Linux specific stats, not populated on Windows.
    34  	PidsStats  docker.PidsStats  `json:"pids_stats,omitempty"`
    35  	BlkioStats docker.BlkioStats `json:"blkio_stats,omitempty"`
    36  
    37  	// Windows specific stats, not populated on Linux.
    38  	NumProcs     uint32              `json:"num_procs"`
    39  	StorageStats docker.StorageStats `json:"storage_stats,omitempty"`
    40  
    41  	// Shared stats
    42  	CPUStats    CPUStats           `json:"cpu_stats,omitempty"`
    43  	PreCPUStats CPUStats           `json:"precpu_stats,omitempty"` // "Pre"="Previous"
    44  	MemoryStats docker.MemoryStats `json:"memory_stats,omitempty"`
    45  }
    46  
    47  type StatsJSON struct {
    48  	Stats
    49  
    50  	Name string `json:"name,omitempty"`
    51  	ID   string `json:"id,omitempty"`
    52  
    53  	// Networks request version >=1.21
    54  	Networks map[string]docker.NetworkStats `json:"networks,omitempty"`
    55  }