github.com/jthurman42/docker@v1.6.0-rc1/api/types/stats.go (about)

     1  // This package is used for API stability in the types and response to the
     2  // consumers of the API stats endpoint.
     3  package types
     4  
     5  import "time"
     6  
     7  type ThrottlingData struct {
     8  	// Number of periods with throttling active
     9  	Periods uint64 `json:"periods"`
    10  	// Number of periods when the container hit its throttling limit.
    11  	ThrottledPeriods uint64 `json:"throttled_periods"`
    12  	// Aggregate time the container was throttled for in nanoseconds.
    13  	ThrottledTime uint64 `json:"throttled_time"`
    14  }
    15  
    16  // All CPU stats are aggregated since container inception.
    17  type CpuUsage struct {
    18  	// Total CPU time consumed.
    19  	// Units: nanoseconds.
    20  	TotalUsage uint64 `json:"total_usage"`
    21  	// Total CPU time consumed per core.
    22  	// Units: nanoseconds.
    23  	PercpuUsage []uint64 `json:"percpu_usage"`
    24  	// Time spent by tasks of the cgroup in kernel mode.
    25  	// Units: nanoseconds.
    26  	UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
    27  	// Time spent by tasks of the cgroup in user mode.
    28  	// Units: nanoseconds.
    29  	UsageInUsermode uint64 `json:"usage_in_usermode"`
    30  }
    31  
    32  type CpuStats struct {
    33  	CpuUsage       CpuUsage       `json:"cpu_usage"`
    34  	SystemUsage    uint64         `json:"system_cpu_usage"`
    35  	ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
    36  }
    37  
    38  type MemoryStats struct {
    39  	// current res_counter usage for memory
    40  	Usage uint64 `json:"usage"`
    41  	// maximum usage ever recorded.
    42  	MaxUsage uint64 `json:"max_usage"`
    43  	// TODO(vishh): Export these as stronger types.
    44  	// all the stats exported via memory.stat.
    45  	Stats map[string]uint64 `json:"stats"`
    46  	// number of times memory usage hits limits.
    47  	Failcnt uint64 `json:"failcnt"`
    48  	Limit   uint64 `json:"limit"`
    49  }
    50  
    51  type BlkioStatEntry struct {
    52  	Major uint64 `json:"major"`
    53  	Minor uint64 `json:"minor"`
    54  	Op    string `json:"op"`
    55  	Value uint64 `json:"value"`
    56  }
    57  
    58  type BlkioStats struct {
    59  	// number of bytes tranferred to and from the block device
    60  	IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"`
    61  	IoServicedRecursive     []BlkioStatEntry `json:"io_serviced_recursive"`
    62  	IoQueuedRecursive       []BlkioStatEntry `json:"io_queue_recursive"`
    63  	IoServiceTimeRecursive  []BlkioStatEntry `json:"io_service_time_recursive"`
    64  	IoWaitTimeRecursive     []BlkioStatEntry `json:"io_wait_time_recursive"`
    65  	IoMergedRecursive       []BlkioStatEntry `json:"io_merged_recursive"`
    66  	IoTimeRecursive         []BlkioStatEntry `json:"io_time_recursive"`
    67  	SectorsRecursive        []BlkioStatEntry `json:"sectors_recursive"`
    68  }
    69  
    70  type Network struct {
    71  	RxBytes   uint64 `json:"rx_bytes"`
    72  	RxPackets uint64 `json:"rx_packets"`
    73  	RxErrors  uint64 `json:"rx_errors"`
    74  	RxDropped uint64 `json:"rx_dropped"`
    75  	TxBytes   uint64 `json:"tx_bytes"`
    76  	TxPackets uint64 `json:"tx_packets"`
    77  	TxErrors  uint64 `json:"tx_errors"`
    78  	TxDropped uint64 `json:"tx_dropped"`
    79  }
    80  
    81  type Stats struct {
    82  	Read        time.Time   `json:"read"`
    83  	Network     Network     `json:"network,omitempty"`
    84  	CpuStats    CpuStats    `json:"cpu_stats,omitempty"`
    85  	MemoryStats MemoryStats `json:"memory_stats,omitempty"`
    86  	BlkioStats  BlkioStats  `json:"blkio_stats,omitempty"`
    87  }