示例#1
0
func SetUint64(b *testing.B, store raft.StableStore) {
	// Run SetUint64 a number of times
	for n := 0; n < b.N; n++ {
		if err := store.SetUint64([]byte{byte(n)}, uint64(n)); err != nil {
			b.Fatalf("err: %s", err)
		}
	}
}
示例#2
0
func GetUint64(b *testing.B, store raft.StableStore) {
	// Create some fake data
	for i := 0; i < 10; i++ {
		if err := store.SetUint64([]byte{byte(i)}, uint64(i)); err != nil {
			b.Fatalf("err: %s", err)
		}
	}
	b.ResetTimer()

	// Run GetUint64 a number of times
	for n := 0; n < b.N; n++ {
		if _, err := store.Get([]byte{0x05}); err != nil {
			b.Fatalf("err: %s", err)
		}
	}
}