mirror of
https://github.com/ii64/gouring.git
synced 2024-11-25 08:16:28 +01:00
bench/perf: use of go sched
Signed-off-by: Nugraha <richiisei@gmail.com>
This commit is contained in:
parent
a5a0584e4d
commit
56090b50c8
2 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue