You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
547 B
21 lines
547 B
#!/usr/bin/env python |
|
# Copyright (c) PLUMgrid, Inc. |
|
# Licensed under the Apache License, Version 2.0 (the "License") |
|
|
|
# This is an example of tracing an event and printing custom fields. |
|
# run in project examples directory with: |
|
# sudo ./trace_fields.py" |
|
|
|
from __future__ import print_function |
|
from bcc import BPF |
|
|
|
prog = """ |
|
int hello(void *ctx) { |
|
bpf_trace_printk("Hello, World!\\n"); |
|
return 0; |
|
} |
|
""" |
|
b = BPF(text=prog) |
|
b.attach_kprobe(event=b.get_syscall_fnname("clone"), fn_name="hello") |
|
print("PID MESSAGE") |
|
b.trace_print(fmt="{1} {5}")
|
|
|