mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
format chore and pre commit hook addition
This commit is contained in:
@ -23,20 +23,20 @@ SEC("tracepoint/syscalls/sys_enter_clone")
|
||||
int hello(struct pt_regs *ctx)
|
||||
{
|
||||
struct data_t data = {};
|
||||
|
||||
|
||||
// Get PID (lower 32 bits of the 64-bit value returned)
|
||||
data.pid = bpf_get_current_pid_tgid() & 0xFFFFFFFF;
|
||||
|
||||
|
||||
// Get timestamp
|
||||
data.ts = bpf_ktime_get_ns();
|
||||
|
||||
|
||||
// Get current process name
|
||||
// bpf_get_current_comm(&data.comm, sizeof(data.comm));
|
||||
|
||||
|
||||
// Submit data to userspace via perf event
|
||||
bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU,
|
||||
bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU,
|
||||
&data, sizeof(data));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <linux/blkdev.h>
|
||||
#define __TARGET_ARCH_aarch64
|
||||
#define __TARGET_ARCH_aarch64
|
||||
#define u64 unsigned long long
|
||||
|
||||
struct {
|
||||
@ -33,11 +33,11 @@ SEC("kprobe/blk_account_io_completion")
|
||||
int BPF_KPROBE(trace_completion, struct request *req)
|
||||
{
|
||||
u64 *tsp, delta;
|
||||
|
||||
|
||||
tsp = bpf_map_lookup_elem(&start, &req);
|
||||
if (tsp) {
|
||||
delta = bpf_ktime_get_ns() - *tsp;
|
||||
bpf_printk("%d %x %d\n", req->__data_len,
|
||||
bpf_printk("%d %x %d\n", req->__data_len,
|
||||
req->cmd_flags, delta / 1000);
|
||||
bpf_map_delete_elem(&start, &req);
|
||||
}
|
||||
|
||||
164152
tests/c-form/vmlinux.h
vendored
164152
tests/c-form/vmlinux.h
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user