FILE
loop1.c
File preview with syntax highlighting.
linux-6.19.14/tools/testing/selftests/bpf/progs/loop1.c
1// SPDX-License-Identifier: GPL-2.0 2// Copyright (c) 2019 Facebook 3#include "vmlinux.h" 4#include <bpf/bpf_helpers.h> 5#include <bpf/bpf_tracing.h> 6 7char _license[] SEC("license") = "GPL"; 8 9SEC("raw_tracepoint/kfree_skb") 10int nested_loops(volatile struct pt_regs* ctx) 11{ 12 int i, j, sum = 0, m; 13 14 for (j = 0; j < 300; j++) 15 for (i = 0; i < j; i++) { 16 if (j & 1) 17 m = PT_REGS_RC(ctx); 18 else 19 m = j; 20 sum += i * m; 21 } 22 23 return sum; 24}
~/
Read-only file preview.