Example #1
0
func benchmarkContainerStart(d *helpers.DockerHelper) {
	cfg := containerOpConfig
	period := cfg["period"].(time.Duration)
	routine := cfg["routine"].(int)
	func() {
		defer d.LogError()
		helpers.LogTitle("container_op")
		helpers.LogEVar(map[string]interface{}{
			"period":  period,
			"routine": routine,
		})
		helpers.LogLabels("qps", "cps")
		for _, q := range cfg["qps"].([]float64) {
			start := time.Now()
			latencies := d.DoParallelContainerStartBenchmark(q, period, routine)
			cps := float64(len(latencies)) / time.Now().Sub(start).Seconds()
			helpers.LogResult(latencies, helpers.Ftoas(q, cps)...)

			start = time.Now()
			latencies = d.DoParallelContainerStopBenchmark(q, routine)
			cps = float64(len(latencies)) / time.Now().Sub(start).Seconds()
			helpers.LogResult(latencies, helpers.Ftoas(q, cps)...)
		}
	}()
}