-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(sroar): Use latest sroar and add histogram in the sbs tool (#7982)
This commit brings in sroar with some more optimizations like cleanup of the bitmap, it also implements histogram in the sbs tool, which will help in better comparison.
- ahsan/bulk-dry-run
- (#7982)
- ahsan/cp/restore-retry
- (#7982)
- ahsan/data-validator
- (#7982)
- ahsan/perf-split
- (#7982)
- ahsan/split
- (#7982)
- ahsan/txn-lock
- (#7982)
- ahsan/update-sroar-2
- (#7982)
- aman/post_update_auth
- (#7982)
- danielmai/debug-tool-print-restore-entries
- (#7982)
- danielmai/release-script-node
- (#7982)
- danielmai/restore-reduce-only
- (#7982)
- joaquin/xgo-dockerfile-update
- (#7982)
- master
- (codegod100/dgraph#1, #7485, vishalbelsare/dgraph#107, rizalgowandy/dgraph#866, #7982)
- naman/binary-split
- (#7982)
- naman/bulk-test
- (#7982)
- naman/cp/drop-data-slash
- (#7982)
- naman/drop-op
- (#7982)
- naman/fix-split
- (#7982)
- omar/ESPLUS-366-fix
- (#7982)
- release/v21.09
- (#7982)
- release/v21.09-slash
- (#7982)
- release/v21.12
- (#7982)
- release/v21.12-slash
- (#7982)
1 parent
18fd841
commit 3233a70
Showing
6 changed files
with
90 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"reflect" | ||
"sync/atomic" | ||
) | ||
|
||
type histogram struct { | ||
bins []float64 | ||
count []uint64 | ||
total uint64 | ||
} | ||
|
||
func newHistogram(bins []float64) *histogram { | ||
return &histogram{ | ||
bins: bins, | ||
count: make([]uint64, len(bins)), | ||
} | ||
} | ||
|
||
func (h *histogram) add(v float64) { | ||
idx := 0 | ||
for i := 0; i < len(h.bins); i++ { | ||
if i+1 >= len(h.bins) { | ||
idx = i | ||
break | ||
} | ||
if h.bins[i] <= v && h.bins[i+1] > v { | ||
idx = i | ||
break | ||
} | ||
} | ||
atomic.AddUint64(&h.count[idx], 1) | ||
atomic.AddUint64(&h.total, 1) | ||
} | ||
|
||
func (h *histogram) show() { | ||
fmt.Printf("-------------- Histogram --------------\nTotal samples: %d\n", | ||
atomic.LoadUint64(&h.total)) | ||
for i := 0; i < len(h.bins); i++ { | ||
pert := float64(atomic.LoadUint64(&h.count[i])) / float64(atomic.LoadUint64(&h.total)) | ||
if i+1 >= len(h.bins) { | ||
fmt.Printf("%.2f - infi --> %.2f\n", h.bins[i], pert) | ||
continue | ||
} | ||
fmt.Printf("%.2f - %.2f --> %.2f\n", h.bins[i], h.bins[i+1], pert) | ||
} | ||
} | ||
|
||
func areEqualJSON(s1, s2 string) bool { | ||
var o1, o2 interface{} | ||
|
||
err := json.Unmarshal([]byte(s1), &o1) | ||
if err != nil { | ||
return false | ||
} | ||
err = json.Unmarshal([]byte(s2), &o2) | ||
if err != nil { | ||
return false | ||
} | ||
return reflect.DeepEqual(o1, o2) | ||
} | ||
|
||
func check(err error) { | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters