summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/remote_client.go
blob: dd0613494aba8ef7b76b778c280ed7616bca2cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// +build varlink remoteclient

package varlinkapi

import (
	"github.com/containers/libpod/cmd/podman/varlink"
	"github.com/containers/libpod/libpod"
)

// ContainerStatsToLibpodContainerStats converts the varlink containerstats to a libpod
// container stats
func ContainerStatsToLibpodContainerStats(stats iopodman.ContainerStats) libpod.ContainerStats {
	cstats := libpod.ContainerStats{
		ContainerID: stats.Id,
		Name:        stats.Name,
		CPU:         stats.Cpu,
		CPUNano:     uint64(stats.Cpu_nano),
		SystemNano:  uint64(stats.System_nano),
		MemUsage:    uint64(stats.Mem_usage),
		MemLimit:    uint64(stats.Mem_limit),
		MemPerc:     stats.Mem_perc,
		NetInput:    uint64(stats.Net_input),
		NetOutput:   uint64(stats.Net_output),
		BlockInput:  uint64(stats.Block_input),
		BlockOutput: uint64(stats.Block_output),
		PIDs:        uint64(stats.Pids),
	}
	return cstats
}