Commit 4cde2d8a authored by Jiri Olsa's avatar Jiri Olsa Committed by Alexei Starovoitov

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: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20230809083440.3209381-25-jolsa@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 3706919e
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sdt.h>
#define __PASTE(a, b) a##b #define __PASTE(a, b) a##b
#define PASTE(a, b) __PASTE(a, b) #define PASTE(a, b) __PASTE(a, b)
...@@ -53,6 +54,27 @@ static int bench(void) ...@@ -53,6 +54,27 @@ static int bench(void)
return 0; 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) int main(int argc, char **argv)
{ {
if (argc != 2) if (argc != 2)
...@@ -60,8 +82,10 @@ int main(int argc, char **argv) ...@@ -60,8 +82,10 @@ int main(int argc, char **argv)
if (!strcmp("bench", argv[1])) if (!strcmp("bench", argv[1]))
return bench(); return bench();
if (!strcmp("usdt", argv[1]))
return usdt();
error: error:
fprintf(stderr, "usage: %s <bench>\n", argv[0]); fprintf(stderr, "usage: %s <bench|usdt>\n", argv[0]);
return -1; return -1;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment