1 // Copyright (c) PLUMgrid, Inc. 2 // Licensed under the Apache License, Version 2.0 (the "License") 3 #include <linux/ptrace.h> 4 struct Ptr { u64 ptr; }; 5 struct Counters { u64 stat1; }; 6 BPF_HASH(stats, struct Ptr, struct Counters, 1024); 7 count_sched(struct pt_regs * ctx)8int count_sched(struct pt_regs *ctx) { 9 struct Ptr key = {.ptr = PT_REGS_PARM1(ctx)}; 10 struct Counters zleaf = {0}; 11 stats.lookup_or_init(&key, &zleaf)->stat1++; 12 return 0; 13 } 14