Linux Audio

Check our new training course

Loading...
Note: File does not exist in v5.9.
 1// SPDX-License-Identifier: GPL-2.0
 2/* Copyright (c) 2021 Facebook */
 3
 4#include "vmlinux.h"
 5#include <bpf/bpf_helpers.h>
 6#include "bpf_misc.h"
 7
 8char _license[] SEC("license") = "GPL";
 9
10u32 nr_loops;
11long hits;
12
13static int empty_callback(__u32 index, void *data)
14{
15	return 0;
16}
17
18SEC("fentry/" SYS_PREFIX "sys_getpgid")
19int benchmark(void *ctx)
20{
21	for (int i = 0; i < 1000; i++) {
22		bpf_loop(nr_loops, empty_callback, NULL, 0);
23
24		__sync_add_and_fetch(&hits, nr_loops);
25	}
26	return 0;
27}