diff options
author | Jiri Olsa <jolsa@kernel.org> | 2023-08-09 10:34:36 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-08-22 00:51:27 +0200 |
commit | 4cde2d8aa7f705fdc395e05d4acd7a9512871f59 (patch) | |
tree | 3a6c56aaeb9555fe9e9b2c30624d55da6d9d8ca1 /tools | |
parent | selftests/bpf: Add uprobe_multi bench test (diff) | |
download | linux-4cde2d8aa7f705fdc395e05d4acd7a9512871f59.tar.xz linux-4cde2d8aa7f705fdc395e05d4acd7a9512871f59.zip |
selftests/bpf: Add uprobe_multi usdt test code
Adding code in uprobe_multi test binary that defines 50k usdts
and will serve as attach point for uprobe_multi usdt bench test
in following patch.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20230809083440.3209381-25-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/bpf/uprobe_multi.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/uprobe_multi.c b/tools/testing/selftests/bpf/uprobe_multi.c index d19184103fa3..a61ceab60b68 100644 --- a/tools/testing/selftests/bpf/uprobe_multi.c +++ b/tools/testing/selftests/bpf/uprobe_multi.c @@ -2,6 +2,7 @@ #include <stdio.h> #include <string.h> +#include <sdt.h> #define __PASTE(a, b) a##b #define PASTE(a, b) __PASTE(a, b) @@ -53,6 +54,27 @@ static int bench(void) return 0; } +#define PROBE STAP_PROBE(test, usdt); + +#define PROBE10 PROBE PROBE PROBE PROBE PROBE \ + PROBE PROBE PROBE PROBE PROBE +#define PROBE100 PROBE10 PROBE10 PROBE10 PROBE10 PROBE10 \ + PROBE10 PROBE10 PROBE10 PROBE10 PROBE10 +#define PROBE1000 PROBE100 PROBE100 PROBE100 PROBE100 PROBE100 \ + PROBE100 PROBE100 PROBE100 PROBE100 PROBE100 +#define PROBE10000 PROBE1000 PROBE1000 PROBE1000 PROBE1000 PROBE1000 \ + PROBE1000 PROBE1000 PROBE1000 PROBE1000 PROBE1000 + +static int usdt(void) +{ + PROBE10000 + PROBE10000 + PROBE10000 + PROBE10000 + PROBE10000 + return 0; +} + int main(int argc, char **argv) { if (argc != 2) @@ -60,8 +82,10 @@ int main(int argc, char **argv) if (!strcmp("bench", argv[1])) return bench(); + if (!strcmp("usdt", argv[1])) + return usdt(); error: - fprintf(stderr, "usage: %s <bench>\n", argv[0]); + fprintf(stderr, "usage: %s <bench|usdt>\n", argv[0]); return -1; } |