MCPcopy
hub / github.com/opencontainers/runc / Stats

Method Stats

libcontainer/container_linux.go:140–164  ·  view source on GitHub ↗

Stats returns statistics for the container.

()

Source from the content-addressed store, hash-verified

138
139// Stats returns statistics for the container.
140func (c *Container) Stats() (*Stats, error) {
141 var (
142 err error
143 stats = &Stats{}
144 )
145 if stats.CgroupStats, err = c.cgroupManager.GetStats(); err != nil {
146 return stats, fmt.Errorf("unable to get container cgroup stats: %w", err)
147 }
148 if c.intelRdtManager != nil {
149 if stats.IntelRdtStats, err = c.intelRdtManager.GetStats(); err != nil {
150 return stats, fmt.Errorf("unable to get container Intel RDT stats: %w", err)
151 }
152 }
153 for _, iface := range c.config.Networks {
154 switch iface.Type {
155 case "veth":
156 istats, err := getNetworkInterfaceStats(iface.HostInterfaceName)
157 if err != nil {
158 return stats, fmt.Errorf("unable to get network stats for interface %q: %w", iface.HostInterfaceName, err)
159 }
160 stats.Interfaces = append(stats.Interfaces, istats)
161 }
162 }
163 return stats, nil
164}
165
166// Set resources of container as configured. Can be used to change resources
167// when the container is running.

Callers 2

events.goFile · 0.80
Example_containerFunction · 0.80

Calls 2

getNetworkInterfaceStatsFunction · 0.85
GetStatsMethod · 0.45

Tested by 1

Example_containerFunction · 0.64