hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/tools/perf/builtin-bench.c
....@@ -11,12 +11,12 @@
1111 * Available benchmark collection list:
1212 *
1313 * sched ... scheduler and IPC performance
14
+ * syscall ... System call performance
1415 * mem ... memory access performance
1516 * numa ... NUMA scheduling and MM performance
1617 * futex ... Futex performance
18
+ * epoll ... Event poll performance
1719 */
18
-#include "perf.h"
19
-#include "util/util.h"
2020 #include <subcmd/parse-options.h>
2121 #include "builtin.h"
2222 #include "bench/bench.h"
....@@ -25,6 +25,7 @@
2525 #include <stdlib.h>
2626 #include <string.h>
2727 #include <sys/prctl.h>
28
+#include <linux/zalloc.h>
2829
2930 typedef int (*bench_fn_t)(int argc, const char **argv);
3031
....@@ -49,9 +50,16 @@
4950 { NULL, NULL, NULL }
5051 };
5152
53
+static struct bench syscall_benchmarks[] = {
54
+ { "basic", "Benchmark for basic getppid(2) calls", bench_syscall_basic },
55
+ { "all", "Run all syscall benchmarks", NULL },
56
+ { NULL, NULL, NULL },
57
+};
58
+
5259 static struct bench mem_benchmarks[] = {
5360 { "memcpy", "Benchmark for memcpy() functions", bench_mem_memcpy },
5461 { "memset", "Benchmark for memset() functions", bench_mem_memset },
62
+ { "find_bit", "Benchmark for find_bit() functions", bench_mem_find_bit },
5563 { "all", "Run all memory access benchmarks", NULL },
5664 { NULL, NULL, NULL }
5765 };
....@@ -67,6 +75,22 @@
6775 { NULL, NULL, NULL }
6876 };
6977
78
+#ifdef HAVE_EVENTFD_SUPPORT
79
+static struct bench epoll_benchmarks[] = {
80
+ { "wait", "Benchmark epoll concurrent epoll_waits", bench_epoll_wait },
81
+ { "ctl", "Benchmark epoll concurrent epoll_ctls", bench_epoll_ctl },
82
+ { "all", "Run all futex benchmarks", NULL },
83
+ { NULL, NULL, NULL }
84
+};
85
+#endif // HAVE_EVENTFD_SUPPORT
86
+
87
+static struct bench internals_benchmarks[] = {
88
+ { "synthesize", "Benchmark perf event synthesis", bench_synthesize },
89
+ { "kallsyms-parse", "Benchmark kallsyms parsing", bench_kallsyms_parse },
90
+ { "inject-build-id", "Benchmark build-id injection", bench_inject_build_id },
91
+ { NULL, NULL, NULL }
92
+};
93
+
7094 struct collection {
7195 const char *name;
7296 const char *summary;
....@@ -75,11 +99,16 @@
7599
76100 static struct collection collections[] = {
77101 { "sched", "Scheduler and IPC benchmarks", sched_benchmarks },
102
+ { "syscall", "System call benchmarks", syscall_benchmarks },
78103 { "mem", "Memory access benchmarks", mem_benchmarks },
79104 #ifdef HAVE_LIBNUMA_SUPPORT
80105 { "numa", "NUMA scheduling and MM benchmarks", numa_benchmarks },
81106 #endif
82107 {"futex", "Futex stressing benchmarks", futex_benchmarks },
108
+#ifdef HAVE_EVENTFD_SUPPORT
109
+ {"epoll", "Epoll stressing benchmarks", epoll_benchmarks },
110
+#endif
111
+ { "internals", "Perf-internals benchmarks", internals_benchmarks },
83112 { "all", "All benchmarks", NULL },
84113 { NULL, NULL, NULL }
85114 };