func dockerStatsToContainerStats(dockerStats *types.StatsJSON) (*ContainerStats, error) {
	if numCores == uint64(0) {
		seelog.Error("Invalid number of cpu cores acquired from the system")
		return nil, fmt.Errorf("invalid number of cpu cores acquired from the system")
	}

	cpuUsage := (dockerStats.CPUStats.CPUUsage.TotalUsage * 100) / numCores
	memoryUsage := dockerStats.MemoryStats.PrivateWorkingSet
	return &ContainerStats{
		cpuUsage:    cpuUsage,
		memoryUsage: memoryUsage,
		timestamp:   dockerStats.Read,
	}, nil
}
func dockerStatsToContainerStats(dockerStats *types.StatsJSON) (*ContainerStats, error) {
	if numCores == uint64(0) {
		seelog.Error("Invalid number of cpu cores acquired from the system")
		return nil, fmt.Errorf("invalid number of cpu cores acquired from the system")
	}

	cpuUsage := (dockerStats.CPUStats.CPUUsage.TotalUsage * 100) / numCores
	memoryUsage := dockerStats.MemoryStats.PrivateWorkingSet
	return &ContainerStats{
		cpuUsage:    cpuUsage,
		memoryUsage: memoryUsage,
		timestamp:   dockerStats.Read,
	}, nil
}
func dockerStatsToContainerStats ( dockerStats * types . StatsJSON ) ( * ContainerStats , error ) { if numCores == uint64 ( 0 ) { seelog . Error ( " " ) return nil , fmt . Errorf ( " " ) } cpuUsage := ( dockerStats . CPUStats . CPUUsage . TotalUsage * 100 ) / numCores memoryUsage := dockerStats . MemoryStats . PrivateWorkingSet return & ContainerStats { cpuUsage : cpuUsage , memoryUsage : memoryUsage , timestamp : dockerStats . Read , } , nil }
// dockerStatsToContainerStats returns a new object of the ContainerStats object from docker stats.
dockerStatsToContainerStats returns a new object of the ContainerStats object from docker stats .