xref: /aosp_15_r20/external/bcc/examples/hello_world.py (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1*387f9dfdSAndroid Build Coastguard Worker#!/usr/bin/python
2*387f9dfdSAndroid Build Coastguard Worker# Copyright (c) PLUMgrid, Inc.
3*387f9dfdSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License")
4*387f9dfdSAndroid Build Coastguard Worker
5*387f9dfdSAndroid Build Coastguard Worker# run in project examples directory with:
6*387f9dfdSAndroid Build Coastguard Worker# sudo ./hello_world.py"
7*387f9dfdSAndroid Build Coastguard Worker# see trace_fields.py for a longer example
8*387f9dfdSAndroid Build Coastguard Worker
9*387f9dfdSAndroid Build Coastguard Workerfrom bcc import BPF
10*387f9dfdSAndroid Build Coastguard Worker
11*387f9dfdSAndroid Build Coastguard Worker# This may not work for 4.17 on x64, you need replace kprobe__sys_clone with kprobe____x64_sys_clone
12*387f9dfdSAndroid Build Coastguard WorkerBPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print()
13