perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)
cover perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)
The intention of a new benchmark is to measure events delivery
bandwidth: N threads produce events and 1 thread consumes events calling epoll_wait(2).
Benchmark does measurements for 8, 16, 32, 64 and 128 threads in a loop.
This one differs from epoll-wait in that it produces events from many threads and consumes from one, thus mp1c (many producers 1 consumer).
Roman Penyaev (2):
perf bench: rename epoll-wait bench to epoll-wait-1pmc perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)
tools/perf/bench/Build | 3 +-
tools/perf/bench/bench.h | 3 +-
.../bench/{epoll-wait.c => epoll-wait-1pmc.c} | 6 +-
tools/perf/bench/epoll-wait-mp1c.c | 175 ++++++++++++++++++
tools/perf/builtin-bench.c | 3 +-
5 files changed, 186 insertions(+), 4 deletions(-)
rename tools/perf/bench/{epoll-wait.c => epoll-wait-1pmc.c} (98%)
create mode 100644 tools/perf/bench/epoll-wait-mp1c.cSignature · 1 line
2.19.1
PATCH 1/2 perf bench: rename epoll-wait bench to epoll-wait-1pmc
I want to rename this in order to add another epoll-wait bench in next patch and to stress in the name, that the bench corresponds to 1 producer and many consumers.
In the following patch I plan to add epoll-wait-mp1c bench.
---
tools/perf/bench/Build | 2 +-
tools/perf/bench/bench.h | 2 +-
tools/perf/bench/{epoll-wait.c => epoll-wait-1pmc.c} | 6 +++++-
tools/perf/builtin-bench.c | 2 +-
4 files changed, 8 insertions(+), 4 deletions(-)
rename tools/perf/bench/{epoll-wait.c => epoll-wait-1pmc.c} (98%)tools/perf/bench/Build +1 -1
@@ -7,7 +7,7 @@ perf-y += futex-wake-parallel.o perf-y += futex-requeue.o perf-y += futex-lock-pi.o -perf-y += epoll-wait.o +perf-y += epoll-wait-1pmc.o perf-y += epoll-ctl.o perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o
tools/perf/bench/bench.h +1 -1
@@ -38,7 +38,7 @@ int bench_futex_requeue(int argc, const char **argv);/* pi futexes */ int bench_futex_lock_pi (int argc,const char **argv); -int bench_epoll_wait (int argc,const char **argv); +int bench_epoll_wait_1pmc (int argc,const char **argv);int bench_epoll_ctl (int argc,const char **argv);#define BENCH_FORMAT_DEFAULT_STR "default"
tools/perf/bench/epoll-wait-1pmc.c renamed from tools/perf/bench/epoll-wait.c +5 -1
@@ -26,6 +26,10 @@* [queue D] ---> [worker] * [queue E] ---> [worker] * +* Both models correspond to 1 producer and many consumers, where a single +* producer is a writer thread and consumers are many workers threads +* waiting for events. +* * Naturally, the single queue will enforce more concurrency on the epoll * instance, and can therefore scale poorly compared to multiple queues. * However, this is a benchmark raw data and must be taken with a grain of
@@ -409,7 +413,7 @@ static int cmpworker(const void *p1, const void *p2)return w1->tid > w2->tid; } -int bench_epoll_wait (int argc,const char **argv) +int bench_epoll_wait_1pmc (int argc,const char **argv) {int ret =0 ;struct sigaction act;
tools/perf/builtin-bench.c +1 -1
@@ -70,7 +70,7 @@ static struct bench futex_benchmarks[] = {#ifdef HAVE_EVENTFD static struct bench epoll_benchmarks[] = { - {"wait" ,"Benchmark epoll concurrent epoll_waits" , bench_epoll_wait }, + {"wait-1pmc" ,"Benchmark epoll concurrent epoll_waits" , bench_epoll_wait_1pmc }, {"ctl" ,"Benchmark epoll concurrent epoll_ctls" , bench_epoll_ctl }, {"all" ,"Run all futex benchmarks" ,NULL }, { NULL, NULL, NULL }
Signature · 1 line
2.19.1
PATCH 2/2 perf bench: Add epoll-wait-mp1c benchmark calling epoll_wait(2)
In reply to Roman PenyaevThe intention of this benchmark is to measure events delivery
bandwidth: N threads produce events and 1 thread consumes events calling epoll_wait(2).
Benchmark does measurements for 8, 16, 32, 64 and 128 threads in a loop.
This one differs from epoll-wait-1pmc in that it produces events from many threads and consumes from one, thus mp1c (many producers 1 consumer).
--- tools/perf/bench/Build | 1 + tools/perf/bench/bench.h | 1 + tools/perf/bench/epoll-wait-mp1c.c | 175 +++++++++++++++++++++++++++++ tools/perf/builtin-bench.c | 1 + 4 files changed, 178 insertions(+) create mode 100644 tools/perf/bench/epoll-wait-mp1c.c
tools/perf/bench/Build +1 -0
@@ -8,6 +8,7 @@ perf-y += futex-requeue.o perf-y += futex-lock-pi.o perf-y += epoll-wait-1pmc.o +perf-y += epoll-wait-mp1c.o perf-y += epoll-ctl.o perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-lib.o
tools/perf/bench/bench.h +1 -0
@@ -39,6 +39,7 @@ int bench_futex_requeue(int argc, const char **argv);int bench_futex_lock_pi (int argc,const char **argv);int bench_epoll_wait_1pmc (int argc,const char **argv); +int bench_epoll_wait_mp1c (int argc,const char **argv);int bench_epoll_ctl (int argc,const char **argv);#define BENCH_FORMAT_DEFAULT_STR "default"
tools/perf/bench/epoll-wait-mp1c.c new file +175 -0
175 lines not on this page · raw message
tools/perf/builtin-bench.c +1 -0
@@ -71,6 +71,7 @@ static struct bench futex_benchmarks[] = {#ifdef HAVE_EVENTFD static struct bench epoll_benchmarks[] = { {"wait-1pmc" ,"Benchmark epoll concurrent epoll_waits" , bench_epoll_wait_1pmc }, + {"wait-mp1c" ,"Benchmark epoll events delivery bandwidth" , bench_epoll_wait_mp1c }, {"ctl" ,"Benchmark epoll concurrent epoll_ctls" , bench_epoll_ctl }, {"all" ,"Run all futex benchmarks" ,NULL }, { NULL, NULL, NULL }
Signature · 1 line
2.19.1