mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
dbb515f01f
Move concepts into specific files for easy management Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael) Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: vmarmol)
29 lines
874 B
Go
29 lines
874 B
Go
/*
|
|
Temporary API endpoint for libcontainer while the full API is finalized (api.go).
|
|
*/
|
|
package libcontainer
|
|
|
|
import (
|
|
"github.com/docker/libcontainer/cgroups/fs"
|
|
"github.com/docker/libcontainer/network"
|
|
)
|
|
|
|
// TODO(vmarmol): Complete Stats() in final libcontainer API and move users to that.
|
|
// DEPRECATED: The below portions are only to be used during the transition to the official API.
|
|
// Returns all available stats for the given container.
|
|
func GetStats(container *Config, state *State) (*ContainerStats, error) {
|
|
var containerStats ContainerStats
|
|
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
|
|
}
|