mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Add sync_count BCC example to use tuple-like assignment
This commit is contained in:
@ -14,10 +14,8 @@ def last() -> HashMap:
|
|||||||
@bpf
|
@bpf
|
||||||
@section("tracepoint/syscalls/sys_enter_sync")
|
@section("tracepoint/syscalls/sys_enter_sync")
|
||||||
def do_trace(ctx: c_void_p) -> c_int64:
|
def do_trace(ctx: c_void_p) -> c_int64:
|
||||||
ts_key = 0
|
ts_key, cnt_key = 0, 1
|
||||||
cnt_key = 1
|
tsp, cntp = last.lookup(ts_key), last.lookup(cnt_key)
|
||||||
tsp = last.lookup(ts_key)
|
|
||||||
cntp = last.lookup(cnt_key)
|
|
||||||
if not cntp:
|
if not cntp:
|
||||||
last.update(cnt_key, 0)
|
last.update(cnt_key, 0)
|
||||||
cntp = last.lookup(cnt_key)
|
cntp = last.lookup(cnt_key)
|
||||||
|
|||||||
Reference in New Issue
Block a user