pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/furkanonder/beetrace

GitHub - furkanonder/beetrace: Trace your python process line by line with eBPF! · GitHub
Skip to content

furkanonder/beetrace

Repository files navigation

Trace your python process line by line with low overhead!

beetrace allows you to trace a Python process line by line or the functions' entries and returns. It uses USDT(User Statically-Defined Tracing) probes with bpftrace.

Dependencies

Installation

pip install beetrace

Usage & Example

To trace the Python process, use the -p parameter to pass the pid value.

beetrace -p {pid of process}

Let's take a look at the quick example.


$ cat -n example.py
1 import os
2 from time import sleep
3
4
5 def c():
6     x = 1
7
8 def b():
9     y = 2
10    c()
11
12
13 def a():
14     z = 1
15     b()
16
17
18 while True:
19     print(f"PID of program: {os.getpid()}")
20     sleep(1)
21     print("Sleep 1 second")
22     a()

Output:

PID of program: 17988
Sleep 1 second
PID of program: 17988
Sleep 1 second
PID of program: 17988
Sleep 1 second
PID of program: 17988
...
...
...
$ beetrace -p 17988
___  ____ ____ ___ ____ ____ ____ ____
|__] |___ |___  |  |__/ |__| |    |___
|__] |___ |___  |  |  \ |  | |___ |___

PID: 17988 | Tracing from: python3 example.py

Press Control-C to quit.

Path                                   File:Line                                          Function
/tmp                                   example.py:18                                      <module>
/tmp                                   example.py:19                                      <module>
/tmp                                   example.py:20                                      <module>
/tmp                                   example.py:21                                      <module>
/tmp                                   example.py:22                                      <module>
/tmp                                   example.py:14                                      a
/tmp                                   example.py:15                                      a
/tmp                                   example.py:9                                       b
/tmp                                   example.py:10                                      b
/tmp                                   example.py:6                                       c
/tmp                                   example.py:18                                      <module>
/tmp                                   example.py:19                                      <module>
/tmp                                   example.py:20                                      <module>
/tmp                                   example.py:21                                      <module>
/tmp                                   example.py:22                                      <module>
/tmp                                   example.py:14                                      a
/tmp                                   example.py:15                                      a
/tmp                                   example.py:9                                       b
/tmp                                   example.py:10                                      b
/tmp                                   example.py:6                                       c
/tmp                                   example.py:18                                      <module>
/tmp                                   example.py:19                                      <module>
/tmp                                   example.py:20                                      <module>
...                                    ...                                                ...
...                                    ...                                                ...
...                                    ...                                                ...
beetrace.mp4

About

Trace your python process line by line with eBPF!

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy