mirror of
https://github.com/ii64/gouring.git
synced 2025-02-16 18:31:47 +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"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
@ -89,6 +90,7 @@ func main() {
|
||||||
if sqe != nil {
|
if sqe != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
runtime.Gosched()
|
||||||
}
|
}
|
||||||
gouring.PrepNop(sqe)
|
gouring.PrepNop(sqe)
|
||||||
sqe.UserData = uint64(i + j)
|
sqe.UserData = uint64(i + j)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package gouring
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -15,7 +16,7 @@ func BenchmarkQueueNop(b *testing.B) {
|
||||||
|
|
||||||
ts := []opt{
|
ts := []opt{
|
||||||
{"def-256", 256, IoUringParams{Flags: 0}},
|
{"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) {
|
consumer := func(h *IoUring, ctx context.Context, count int) {
|
||||||
|
@ -60,6 +61,7 @@ func BenchmarkQueueNop(b *testing.B) {
|
||||||
if sqe != nil {
|
if sqe != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
runtime.Gosched()
|
||||||
}
|
}
|
||||||
PrepNop(sqe)
|
PrepNop(sqe)
|
||||||
sqe.UserData = uint64(i + int(j))
|
sqe.UserData = uint64(i + int(j))
|
||||||
|
|
Loading…
Add table
Reference in a new issue