Example #1
0
func mapReadTestSeries(cMap concurrentmap.ConcurrentMap) int {

	s1 := rand.NewSource(time.Now().UnixNano())
	rng := rand.New(s1)
	notFound := 0

	for i := 0; i < numberOfTests; i++ {
		key := strconv.Itoa(rng.Intn(numberOfTests))
		val, e := cMap.Get(key)
		if val != key {
			fmt.Println("Key/Val Mismatch:", key, val)
		}
		if !e {
			notFound++
		}
	}
	return notFound
}
Example #2
0
func readConcurrent(cMap concurrentmap.ConcurrentMap, threadID int, numReadThreads int, done chan int64) {
	start := time.Now().UnixNano()

	s1 := rand.NewSource(time.Now().UnixNano() * int64(threadID))
	rng := rand.New(s1)
	notFound := 0

	for i := 0; i < numberOfTests/numReadThreads; i++ {
		key := strconv.Itoa(rng.Intn(numberOfTests))
		_, e := cMap.Get(key)
		if !e {
			notFound++
		}
	}

	end := time.Now().UnixNano()

	done <- end - start
	return

}