bench/perf: use of go sched

Signed-off-by: Nugraha <richiisei@gmail.com>
This commit is contained in:
Xeffy Chen 2022-07-07 23:31:18 +07:00
parent a5a0584e4d
commit 56090b50c8
Signed by: Xeffy
GPG key ID: E41C08AD390E7C49
2 changed files with 5 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"os"
"runtime"
"runtime/pprof"
"syscall"
"time"
@ -89,6 +90,7 @@ func main() {
if sqe != nil {
break
}
runtime.Gosched()
}
gouring.PrepNop(sqe)
sqe.UserData = uint64(i + j)

View file

@ -2,6 +2,7 @@ package gouring
import (
"context"
"runtime"
"syscall"
"testing"
)
@ -15,7 +16,7 @@ func BenchmarkQueueNop(b *testing.B) {
ts := []opt{
{"def-256", 256, IoUringParams{Flags: 0}},
{"sqpoll-256-4-10000", 256, IoUringParams{Flags: IORING_SETUP_SQPOLL, SqThreadCpu: 8, SqThreadIdle: 10_000}},
{"sqpoll-256-4-10000", 256, IoUringParams{Flags: IORING_SETUP_SQPOLL, SqThreadCpu: 16, SqThreadIdle: 10_000}},
}
consumer := func(h *IoUring, ctx context.Context, count int) {
@ -60,6 +61,7 @@ func BenchmarkQueueNop(b *testing.B) {
if sqe != nil {
break
}
runtime.Gosched()
}
PrepNop(sqe)
sqe.UserData = uint64(i + int(j))