Skip to content

Commit d63e121

Browse files
olsajiriKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
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 <[email protected]>
1 parent 44d238b commit d63e121

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tools/testing/selftests/bpf/uprobe_multi.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <stdio.h>
44
#include <string.h>
5+
#include <sdt.h>
56

67
#define __PASTE(a, b) a##b
78
#define PASTE(a, b) __PASTE(a, b)
@@ -53,15 +54,38 @@ static int bench(void)
5354
return 0;
5455
}
5556

57+
#define PROBE STAP_PROBE(test, usdt);
58+
59+
#define PROBE10 PROBE PROBE PROBE PROBE PROBE \
60+
PROBE PROBE PROBE PROBE PROBE
61+
#define PROBE100 PROBE10 PROBE10 PROBE10 PROBE10 PROBE10 \
62+
PROBE10 PROBE10 PROBE10 PROBE10 PROBE10
63+
#define PROBE1000 PROBE100 PROBE100 PROBE100 PROBE100 PROBE100 \
64+
PROBE100 PROBE100 PROBE100 PROBE100 PROBE100
65+
#define PROBE10000 PROBE1000 PROBE1000 PROBE1000 PROBE1000 PROBE1000 \
66+
PROBE1000 PROBE1000 PROBE1000 PROBE1000 PROBE1000
67+
68+
static int usdt(void)
69+
{
70+
PROBE10000
71+
PROBE10000
72+
PROBE10000
73+
PROBE10000
74+
PROBE10000
75+
return 0;
76+
}
77+
5678
int main(int argc, char **argv)
5779
{
5880
if (argc != 2)
5981
goto error;
6082

6183
if (!strcmp("bench", argv[1]))
6284
return bench();
85+
if (!strcmp("usdt", argv[1]))
86+
return usdt();
6387

6488
error:
65-
fprintf(stderr, "usage: %s <bench>\n", argv[0]);
89+
fprintf(stderr, "usage: %s <bench|usdt>\n", argv[0]);
6690
return -1;
6791
}

0 commit comments

Comments
 (0)