mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Fix variable initialization in BPF tracepoint example
This commit is contained in:
committed by
GitHub
parent
0fd6bea211
commit
dc995a1448
@ -88,15 +88,14 @@ def hist() -> HashMap:
|
||||
@section("tracepoint/syscalls/sys_enter_clone")
|
||||
def hello(ctx: c_void_p) -> c_int64:
|
||||
process_id = pid()
|
||||
one = 1
|
||||
prev = hist.lookup(process_id)
|
||||
if prev:
|
||||
previous_value = prev + 1
|
||||
print(f"count: {previous_value} with {process_id}")
|
||||
hist.update(process_id, previous_value)
|
||||
return c_int64(0)
|
||||
return 0
|
||||
else:
|
||||
hist.update(process_id, one)
|
||||
hist.update(process_id, 1)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user