From 0443fa9529c197c74dc25f16fe47bae4d9b737cc Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Mon, 19 Dec 2016 18:10:08 -0600 Subject: [PATCH] Unexport zipf implementation details --- bench/zipf.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bench/zipf.go b/bench/zipf.go index c382d0aab..1c27d6184 100644 --- a/bench/zipf.go +++ b/bench/zipf.go @@ -24,11 +24,11 @@ type ZipfSetBits struct { ProfileIDRange int64 `json:"profile-id-range"` Iterations int `json:"iterations"` Seed int64 `json:"seed"` - BitmapRng *rand.Zipf `json:"-"` + DB string `json:"db"` + bitmapRng *rand.Zipf `json:"-"` ProfileRng *rand.Zipf `json:"-"` BitmapPerm *PermutationGenerator `json:"-"` ProfilePerm *PermutationGenerator `json:"-"` - DB string `json:"db"` BitmapExponent float64 `json:"bitmap-exponent"` BitmapRatio float64 `json:"bitmap-ratio"` @@ -125,12 +125,12 @@ func (b *ZipfSetBits) Init(hosts []string, agentNum int) error { b.Name = "ZipfSetBits" rnd := rand.New(rand.NewSource(b.Seed + int64(agentNum))) bitmapOffset := getZipfOffset(b.BitmapIDRange, b.BitmapExponent, b.BitmapRatio) - b.BitmapRng = rand.NewZipf(rnd, b.BitmapExponent, bitmapOffset, uint64(b.BitmapIDRange-1)) + b.bitmapRng = rand.NewZipf(rnd, b.BitmapExponent, bitmapOffset, uint64(b.BitmapIDRange-1)) profileOffset := getZipfOffset(b.ProfileIDRange, b.ProfileExponent, b.ProfileRatio) - b.ProfileRng = rand.NewZipf(rnd, b.ProfileExponent, profileOffset, uint64(b.ProfileIDRange-1)) + b.profileRng = rand.NewZipf(rnd, b.ProfileExponent, profileOffset, uint64(b.ProfileIDRange-1)) - b.BitmapPerm = NewPermutationGenerator(b.BitmapIDRange, b.Seed) - b.ProfilePerm = NewPermutationGenerator(b.ProfileIDRange, b.Seed+1) + b.bitmapPerm = NewPermutationGenerator(b.BitmapIDRange, b.Seed) + b.profilePerm = NewPermutationGenerator(b.ProfileIDRange, b.Seed+1) return b.HasClient.Init(hosts, agentNum) } @@ -146,11 +146,11 @@ func (b *ZipfSetBits) Run(ctx context.Context, agentNum int) map[string]interfac var start time.Time for n := 0; n < b.Iterations; n++ { // generate IDs from Zipf distribution - bitmapIDOriginal := b.BitmapRng.Uint64() - profIDOriginal := b.ProfileRng.Uint64() + bitmapIDOriginal := b.bitmapRng.Uint64() + profIDOriginal := b.profileRng.Uint64() // permute IDs randomly, but repeatably - bitmapID := b.BitmapPerm.Next(int64(bitmapIDOriginal)) - profID := b.ProfilePerm.Next(int64(profIDOriginal)) + bitmapID := b.bitmapPerm.Next(int64(bitmapIDOriginal)) + profID := b.profilePerm.Next(int64(profIDOriginal)) query := fmt.Sprintf("SetBit(%d, 'frame.n', %d)", b.BaseBitmapID+int64(bitmapID), b.BaseProfileID+int64(profID)) start = time.Now()