mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
edf1e856a0
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
24 lines
614 B
Go
24 lines
614 B
Go
package libcontainer
|
|
|
|
import (
|
|
"github.com/docker/libcontainer/cgroups/fs"
|
|
"github.com/docker/libcontainer/network"
|
|
)
|
|
|
|
// Returns all available stats for the given container.
|
|
func GetContainerStats(container *Config, state *State) (*ContainerStats, error) {
|
|
containerStats := NewContainerStats()
|
|
stats, err := fs.GetStats(container.Cgroups)
|
|
if err != nil {
|
|
return containerStats, err
|
|
}
|
|
containerStats.CgroupStats = stats
|
|
networkStats, err := network.GetStats(&state.NetworkState)
|
|
if err != nil {
|
|
return containerStats, err
|
|
}
|
|
containerStats.NetworkStats = networkStats
|
|
|
|
return containerStats, nil
|
|
}
|