Add sync_count BCC example to use tuple-like assignment

This commit is contained in:
Pragyansh Chaturvedi
2025-10-14 23:33:54 +05:30
parent c56928bc8a
commit 0a1557e318

View File

@ -14,10 +14,8 @@ def last() -> HashMap:
@bpf
@section("tracepoint/syscalls/sys_enter_sync")
def do_trace(ctx: c_void_p) -> c_int64:
ts_key = 0
cnt_key = 1
tsp = last.lookup(ts_key)
cntp = last.lookup(cnt_key)
ts_key, cnt_key = 0, 1
tsp, cntp = last.lookup(ts_key), last.lookup(cnt_key)
if not cntp:
last.update(cnt_key, 0)
cntp = last.lookup(cnt_key)