INNER CODE UNIT · Go

createCacheAndPopulate

go-graphite/go-carbon · cache/cache_test.go:67

func createCacheAndPopulate(metricsCount int, maxPointsPerMetric int) *Cache {
	if cache != nil {
		return cache
	}
	cache = New()

	for i := 0; i < metricsCount; i++ {
		m := fmt.Sprintf("%d.metric.name.for.bench.test.%d", rand.IntN(metricsCount), i)

		p := points.OnePoint(m, 0, int64(i))
		for j := 0; j < rand.IntN(maxPointsPerMetric)+1; j++ {
			p.Add(0, int64(i+j))
		}
		cache.Add(p)
	}
	cache.makeQueue() // warmup
	return cache
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…