File: test_trace2.b

package info (click to toggle)
bpfcc 0.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,368 kB
  • sloc: ansic: 132,727; python: 36,226; cpp: 26,973; sh: 710; yacc: 525; makefile: 141; lex: 94
file content (11 lines) | stat: -rw-r--r-- 354 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
// Copyright (c) PLUMgrid, Inc.
// Licensed under the Apache License, Version 2.0 (the "License")
#include "kprobe.b"
struct Ptr { u64 ptr:64; };
struct Counters { u64 stat1:64; };
Table<Ptr, Counters, FIXED_MATCH, AUTO> stats(1024);

u32 count_sched (struct proto::pt_regs *ctx) {
  struct Ptr key = {.ptr=ctx->bx};
  atomic_add(stats[key].stat1, 1);
}