code: func removeTerminatedContainerInfo(containerInfo map[string]cadvisorapiv2.ContainerInfo) map[string]cadvisorapiv2.ContainerInfo {
  	cinfoMap := make(map[containerID][]containerInfoWithCgroup)
  	for key, cinfo := range containerInfo {
  		if !isPodManagedContainer(&cinfo) {
  			continue
  		}
  		cinfoID := containerID{
  			podRef:        buildPodRef(cinfo.Spec.Labels),
  			containerName: kubetypes.GetContainerName(cinfo.Spec.Labels),
  		}
  		cinfoMap[cinfoID] = append(cinfoMap[cinfoID], containerInfoWithCgroup{
  			cinfo:  cinfo,
  			cgroup: key,
  		})
  	}
  	result := make(map[string]cadvisorapiv2.ContainerInfo)
  	for _, refs := range cinfoMap {
  		if len(refs) == 1 {
  			result[refs[0].cgroup] = refs[0].cinfo
  			continue
  		}
  		sort.Sort(ByCreationTime(refs))
  		i := 0
  		for ; i < len(refs); i++ {
  			if hasMemoryAndCPUInstUsage(&refs[i].cinfo) {
  				// Stops removing when we first see an info with non-zero
  				// CPU/Memory usage.
  				break
  			}
  		}
  		for ; i < len(refs); i++ {
  			result[refs[i].cgroup] = refs[i].cinfo
  		}
  	}
  	return result
  }
docs: // removeTerminatedContainerInfo returns the specified containerInfo but with
  // the stats of the terminated containers removed.
  //
  // A ContainerInfo is considered to be of a terminated container if it has an
  // older CreationTime and zero CPU instantaneous and memory RSS usage.