mirror of
https://github.com/ii64/gouring.git
synced 2024-11-21 14:37:16 +01:00
bench/perf: handle interrupt from iouring enter
Other adjustments: * Fix miss results, using `SeenCqe` to pop CQ entry. * Increase sqpoll thread cpu to 16. * Fix CQE/SQE to Cqe/Sqe function name. * Fix UserData usage. Benchmark: * Increase number of N to 10_000_000
This commit is contained in:
parent
0fee4d7a7f
commit
98f78a3b9f
2 changed files with 17 additions and 9 deletions
|
@ -1,10 +1,14 @@
|
|||
alL: run
|
||||
|
||||
N := 100000
|
||||
PERF_OPTS := -n $(N) -noti $(N)
|
||||
N := 10000000
|
||||
PERF_OPTS := -n $(N) -noti 5000000
|
||||
|
||||
GCFLAGS := $(GCFLAGS)
|
||||
#GCFLAGS += -m=2
|
||||
#GCFLAGS += -l=4
|
||||
|
||||
build:
|
||||
go build .
|
||||
go build -gcflags="$(GCFLAGS)" .
|
||||
|
||||
run: build
|
||||
./perf $(PERF_OPTS) -pprofCpu pprof-nonsqpoll.cpu
|
||||
|
|
|
@ -29,8 +29,8 @@ var (
|
|||
func init() {
|
||||
fs.UintVar(&entries, "entries", 256, "Entries")
|
||||
fs.BoolVar(&sqPoll, "sqpoll", false, "Enable SQPOLL")
|
||||
fs.UintVar(&sqThreadCpu, "sqthreadcpu", 4, "SQ Thread CPU")
|
||||
fs.UintVar(&sqThreadIdle, "sqthreadidle", 10_000, "SQ Thread idle")
|
||||
fs.UintVar(&sqThreadCpu, "sqthreadcpu", 16, "SQ Thread CPU")
|
||||
fs.UintVar(&sqThreadIdle, "sqthreadidle", 10_000, "SQ Thread idle") // milliseconds
|
||||
|
||||
fs.UintVar(&N, "n", 10_000, "N times")
|
||||
fs.UintVar(¬i, "noti", 10_000, "Notify per attempt N")
|
||||
|
@ -86,14 +86,14 @@ func main() {
|
|||
for j = 0; j < entries; j++ {
|
||||
for {
|
||||
// sqe could be nil if SQ is already full so we spin until we got one
|
||||
sqe = h.GetSQE()
|
||||
sqe = h.GetSqe()
|
||||
if sqe != nil {
|
||||
break
|
||||
}
|
||||
runtime.Gosched()
|
||||
}
|
||||
gouring.PrepNop(sqe)
|
||||
sqe.UserData = uint64(i + j)
|
||||
sqe.UserData.SetUint64(uint64(i + j))
|
||||
}
|
||||
submitted, err = h.Submit()
|
||||
if err != nil {
|
||||
|
@ -105,7 +105,10 @@ func main() {
|
|||
}
|
||||
|
||||
for j = 0; j < entries; j++ {
|
||||
err = h.WaitCQE(&cqe)
|
||||
err = h.WaitCqe(&cqe)
|
||||
if err == syscall.EINTR {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -115,7 +118,8 @@ func main() {
|
|||
if cqe.Res < 0 {
|
||||
panic(syscall.Errno(-cqe.Res))
|
||||
}
|
||||
_ = cqe
|
||||
|
||||
h.SeenCqe(cqe)
|
||||
}
|
||||
}
|
||||
_ = submitted
|
||||
|
|
Loading…
Reference in a new issue