Last active
October 16, 2020 07:15
-
-
Save mattnite/a3637625730c90480c522aba2d325cbe to your computer and use it in GitHub Desktop.
simple BPF program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const mem = std.mem | |
usingnamespace @import("bpf"); | |
export var events linksection("maps") = PerfEventArray.init(256, 0); | |
export fn bpf_prog(ctx: *SkBuff) linksection("socket1") c_int { | |
var time = ktime_get_ns(); | |
events.event_output(ctx, F_CURRENT_CPU, mem.asBytes(&time)) catch {}; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment