ftrace-0.0.1
توضیحات
library for reading ftrace data
| ویژگی | مقدار |
|---|---|
| سیستم عامل | POSIX :: Linux |
| نام فایل | ftrace-0.0.1 |
| نام | ftrace |
| نسخه کتابخانه | 0.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Manfred Kaiser |
| ایمیل نویسنده | manfred.kaiser@logfile.at |
| آدرس صفحه اصلی | https://github.com/manfred-kaiser/python-ftrace |
| آدرس اینترنتی | https://pypi.org/project/ftrace/ |
| مجوز | - |
# Python ftrace Library
`ftrace` is a python library to read ftrace data from the Linux Kernel.
At this time it is only compatible with Kernel Version <=4!
## Installation
`pip install ftrace`
## Example
When a new process is created the name, pid and parent pid will be printed.
```python
import ftrace
def main():
processes = {}
ftrace = ftrace.FTrace()
ftrace.tracer = ftrace.tracers.NopTracer()
ftrace.reset()
ftrace.setup()
ftrace.tracer.syscalls = [
ftrace.syscalls.Sys_Execve(),
ftrace.syscalls.Sched_Process_Fork()
]
print("pid ppid: name")
try:
for data in ftrace.get_output():
if (data is not None and data["kname"] == "sys_execve_kprobe"):
print("{} {}: {}".format(data["caller_pid"], processes[data["caller_pid"]] if (data["caller_pid"] in processes) else "----", data["filename"]))
elif (data["kname"] == "sched_process_fork"):
processes[data["called_pid"]] = data["caller_pid"]
except KeyboardInterrupt:
print("\nstopping...")
ftrace.reset()
if __name__ == "__main__":
main()
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >= 3.5 | Python |
نحوه نصب
نصب پکیج whl ftrace-0.0.1:
pip install ftrace-0.0.1.whl
نصب پکیج tar.gz ftrace-0.0.1:
pip install ftrace-0.0.1.tar.gz