Skip to content
Snippets Groups Projects
Commit 799ad2b4 authored by Luis Gerhorst's avatar Luis Gerhorst
Browse files

Repeat init

parent b7d78dfa
No related branches found
No related tags found
No related merge requests found
......@@ -41,15 +41,16 @@ static void bump_memlock_rlimit(void)
}
static void print_usage(char **argv) {
fprintf(stderr, "Usage: %s user|bpf <iter>", argv[0]);
fprintf(stderr, "Usage: %s user|bpf <init> <iter>", argv[0]);
}
int main(int argc, char **argv)
{
if (argc != 3) {
if (argc != 4) {
print_usage(argv);
return 1;
}
bool user;
if (strcmp("bpf", argv[1]) == 0) {
user = false;
......@@ -59,15 +60,21 @@ int main(int argc, char **argv)
print_usage(argv);
return 1;
}
int iter = atoi(argv[2]);
if (iter < 0) {
int init = atoi(argv[2]);
if (init < 0) {
print_usage(argv);
return 1;
}
int err;
int iter = atoi(argv[3]);
if (iter < 0) {
print_usage(argv);
return 1;
}
int err = 0;
for (int k = 0; k < init; k++) {
if (user) {
int *fds = malloc(sizeof(int) * SIZE);
if (fds == NULL) {
......@@ -97,7 +104,7 @@ int main(int argc, char **argv)
struct task_bulk_bpf *skel;
/* Set up libbpf errors and debug info callback */
libbpf_set_print(libbpf_print_fn);
/* libbpf_set_print(libbpf_print_fn); */
/* Bump RLIMIT_MEMLOCK to allow BPF sub-system to do anything */
bump_memlock_rlimit();
......@@ -127,6 +134,7 @@ int main(int argc, char **argv)
cleanup:
task_bulk_bpf__destroy(skel);
}
}
return -err;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment