mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
benchmarks: add more threads arguments for sysbench benchmark
Signed-off-by: Chen Hui <cedriccchen@tencent.com>
This commit is contained in:
@@ -16,6 +16,7 @@ package sysbench_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/test/dockerutil"
|
||||
@@ -24,8 +25,9 @@ import (
|
||||
)
|
||||
|
||||
type testCase struct {
|
||||
name string
|
||||
test tools.Sysbench
|
||||
name string
|
||||
threads int
|
||||
test tools.Sysbench
|
||||
}
|
||||
|
||||
// BenchmarSysbench runs sysbench on the runtime.
|
||||
@@ -39,6 +41,15 @@ func BenchmarkSysbench(b *testing.B) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "CPU",
|
||||
threads: 16,
|
||||
test: &tools.SysbenchCPU{
|
||||
SysbenchBase: tools.SysbenchBase{
|
||||
Threads: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Memory",
|
||||
test: &tools.SysbenchMemory{
|
||||
@@ -47,6 +58,15 @@ func BenchmarkSysbench(b *testing.B) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Memory",
|
||||
threads: 16,
|
||||
test: &tools.SysbenchMemory{
|
||||
SysbenchBase: tools.SysbenchBase{
|
||||
Threads: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Mutex",
|
||||
test: &tools.SysbenchMutex{
|
||||
@@ -68,9 +88,21 @@ func BenchmarkSysbench(b *testing.B) {
|
||||
Name: "testname",
|
||||
Value: tc.name,
|
||||
}
|
||||
name, err := tools.ParametersToName(param)
|
||||
if err != nil {
|
||||
b.Fatalf("Failed to parse params: %v", err)
|
||||
var name string
|
||||
if tc.threads != 0 {
|
||||
threads := tools.Parameter{
|
||||
Name: "threads",
|
||||
Value: fmt.Sprintf("%d", tc.threads),
|
||||
}
|
||||
name, err = tools.ParametersToName(param, threads)
|
||||
if err != nil {
|
||||
b.Fatalf("Failed to parse params: %v", err)
|
||||
}
|
||||
} else {
|
||||
name, err = tools.ParametersToName(param)
|
||||
if err != nil {
|
||||
b.Fatalf("Failed to parse params: %v", err)
|
||||
}
|
||||
}
|
||||
b.Run(name, func(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user