Esempio n. 1
0
// Return aggregated percentiles from the provided percentile samples.
func GetDerivedPercentiles(stats []*info.Usage) info.Usage {
	cpu := NewResource(len(stats))
	memory := NewResource(len(stats))
	for _, stat := range stats {
		cpu.Add(stat.Cpu)
		memory.Add(stat.Memory)
	}
	usage := info.Usage{}
	usage.Cpu = cpu.GetPercentile()
	usage.Memory = memory.GetPercentile()
	return usage
}
Esempio n. 2
0
func createSample(i uint64) info.Usage {
	usage := info.Usage{}
	usage.PercentComplete = 100
	usage.Cpu = info.Percentiles{
		Present: true,
		Mean:    i * 50,
		Max:     i * 100,
		Ninety:  i * 90,
	}
	usage.Memory = info.Percentiles{
		Present: true,
		Mean:    i * 50 * 1024,
		Max:     i * 100 * 1024,
		Ninety:  i * 90 * 1024,
	}
	return usage
}