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