草庐IT

PTRACE_EVENT_VFORK

全部标签

c - 用 `perf record -g` 模拟 `perf_event_open`

我的目标是编写一些代码以在某个时间间隔记录所有CPU的当前调用堆栈。本质上,我想做与perfrecord相同的事情,但我自己使用perf_event_open。根据联机帮助页,我似乎需要使用PERF_SAMPLE_CALLCHAIN示例类型并使用mmap读取结果。也就是说,联机帮助页非常简洁,一些示例代码现在可以发挥很大作用。有人能指出我正确的方向吗? 最佳答案 了解这一点的最佳方法是阅读Linux内核源代码并了解如何自己模拟perfrecord-g。正如您正确识别的那样,perfevents的记录将从系统调用perf_event_

linux - 如何更改 perf_event_open 最大采样率

我正在使用perf_event_open获取样本。我试着让每个人都说到点子上。但是perf_event_open不够快。我尝试使用以下命令更改采样率:echo10000000>/proc/sys/kernel/perf_event_max_sample_rate但是看起来我设置的值太大了。运行我的代码后,perf_event_max_sample_rate变回较低的值,例如12500。当我尝试更改更大的值时,例如20000000、50000000等,采样速度不会随着我更改的值而增加。有什么方法可以更快地改变perf_event_open采样速度吗? 最佳答案

linux - 如何更改 perf_event_open 最大采样率

我正在使用perf_event_open获取样本。我试着让每个人都说到点子上。但是perf_event_open不够快。我尝试使用以下命令更改采样率:echo10000000>/proc/sys/kernel/perf_event_max_sample_rate但是看起来我设置的值太大了。运行我的代码后,perf_event_max_sample_rate变回较低的值,例如12500。当我尝试更改更大的值时,例如20000000、50000000等,采样速度不会随着我更改的值而增加。有什么方法可以更快地改变perf_event_open采样速度吗? 最佳答案

linux - 如何仅使用 ptrace (linux, x86/x86_64) 获取 "backtrace"(如 gdb)

我想像gdb一样得到类似backtrace的输出。但我想通过ptrace()直接执行此操作。我的平台是Linux,x86;以及后来的x86_64。现在我只想从堆栈中读取返回地址,而不转换为符号名称。所以,对于测试程序,通过gcc-4.5以-O0方式编译:intg(){kill(getpid(),SIGALRM);}intf(){inta;intb;a=g();b=a;returna+b;}inte(){intc;c=f();}main(){returne();}我将启动一个我的程序,并在一开始就连接ptrace来测试程序。然后,我将执行PTRACE_CONT并等待信号。测试程序何时会进

linux - 如何仅使用 ptrace (linux, x86/x86_64) 获取 "backtrace"(如 gdb)

我想像gdb一样得到类似backtrace的输出。但我想通过ptrace()直接执行此操作。我的平台是Linux,x86;以及后来的x86_64。现在我只想从堆栈中读取返回地址,而不转换为符号名称。所以,对于测试程序,通过gcc-4.5以-O0方式编译:intg(){kill(getpid(),SIGALRM);}intf(){inta;intb;a=g();b=a;returna+b;}inte(){intc;c=f();}main(){returne();}我将启动一个我的程序,并在一开始就连接ptrace来测试程序。然后,我将执行PTRACE_CONT并等待信号。测试程序何时会进

linux - 无法从/dev/input/event* 获取鼠标 move 事件

使用evtest时无法获取鼠标move事件测试输入事件的工具。我只得到三个鼠标事件:leftclickevent:type=EV_KEY,code=272(LeftBtn),value=1/0rightclickevent:type=EV_KEY,code=273(RightBtn),value=1/0mousewheelevent:type=EV_REL,code=8(Wheel),value=-1没有鼠标move事件。那么我的鼠标move事件在哪里以及如何捕获它?ps:在安装了virtualBox-addition的VirtualBox-4中的Ubuntu11.04和Gentoo上

linux - 无法从/dev/input/event* 获取鼠标 move 事件

使用evtest时无法获取鼠标move事件测试输入事件的工具。我只得到三个鼠标事件:leftclickevent:type=EV_KEY,code=272(LeftBtn),value=1/0rightclickevent:type=EV_KEY,code=273(RightBtn),value=1/0mousewheelevent:type=EV_REL,code=8(Wheel),value=-1没有鼠标move事件。那么我的鼠标move事件在哪里以及如何捕获它?ps:在安装了virtualBox-addition的VirtualBox-4中的Ubuntu11.04和Gentoo上

linux - epoll_event结构体(epoll)中参数的意义

我正在使用epoll_ctl()和epoll_wait()系统调用。intepoll_ctl(intepfd,intop,intfd,structepoll_event*event);intepoll_wait(intepfd,structepoll_event*events,intmaxevents,inttimeout);structepoll_event{uint32_tevents;/*epollevents(bitmask)*/epoll_data_tdata;/*Userdata*/};typedefunionepoll_data{entercodehere`void*pt

linux - epoll_event结构体(epoll)中参数的意义

我正在使用epoll_ctl()和epoll_wait()系统调用。intepoll_ctl(intepfd,intop,intfd,structepoll_event*event);intepoll_wait(intepfd,structepoll_event*events,intmaxevents,inttimeout);structepoll_event{uint32_tevents;/*epollevents(bitmask)*/epoll_data_tdata;/*Userdata*/};typedefunionepoll_data{entercodehere`void*pt

c - 为什么这个 ptrace 程序说系统调用返回了 -38?

与thisone相同除了我正在运行execl("/bin/ls","ls",NULL);。结果显然是错误的,因为每个系统调用都返回-38:[user@test]#./test_tracesyscall59calledwithrdi(0),rsi(0),rdx(0)syscall12returnedwith-38syscall12calledwithrdi(0),rsi(0),rdx(140737288485480)syscall9returnedwith-38syscall9calledwithrdi(0),rsi(4096),rdx(3)syscall9returnedwith-38