Esempio n. 1
0
func withLLRB(count int, outch chan [][]interface{}) {
	d := llrb.NewDict()
	ds := llrb.NewLLRB()
	stats := make(map[string]int)
	for count > 0 {
		count--
		cmds := <-outch
		for _, cmd := range cmds {
			stats = validate(d, ds, cmd, stats)
		}
	}
	validateEqual(d, ds)
	printStats(stats)
	avg, sd := ds.HeightStats()
	fmt.Printf("LLRB Stats: avg-height: %4.2f, sd-height: %4.2f\n", avg, sd)
}
Esempio n. 2
0
func argParse() {
	var ops string
	var algo string
	flag.IntVar(&options.bcount, "count", 1,
		"data set size")
	flag.IntVar(&options.readers, "readers", 2,
		"number of concurrent readers to use with MVCC")
	flag.StringVar(&options.pprof, "pprof", "",
		"filename to save pprof o/p")
	flag.StringVar(&options.mprof, "mprof", "",
		"filename to save mprof o/p")
	flag.StringVar(&ops, "ops", "",
		"operations to profile")
	flag.StringVar(&algo, "algo", "llrb",
		"operations to profile")
	flag.IntVar(&options.mtick, "mtick", 0,
		"periodic tick to dump mem-stat, in mS")
	flag.Parse()

	options.ops = make([]string, 0)
	for _, op := range strings.Split(ops, ",") {
		if strings.Trim(op, " ") == "" {
			continue
		}
		options.ops = append(options.ops, op)
	}
	options.algo = make(map[string]llrb.MemStore)
	for _, algo := range strings.Split(algo, ",") {
		if strings.Trim(algo, " ") == "" {
			continue
		}
		switch algo {
		case "llrb":
			options.algo[algo] = llrb.NewLLRB()
		case "mvcc":
			options.algo[algo] = llrb.NewLLRBMVCC(10)
		}
	}
}