[英]how perf record get the virtual memory address of instruction of the target process and what data struct does perf use to store it
我正在阅读perf的源代码,并尝试理解perf record
如何获取触发perf计数的目标进程的指令的虚拟内存地址(例如, call test
的虚拟地址,该代码是受监视的汇编代码)通过性能perf report
的注释)。 perf使用什么数据结构来存储使perf事件发生并触发计数器的指令的虚拟地址?
为了得到样品的指令指针,你必须包括PERF_SAMPLE_IP
在perf_attr.sample_type
为perf_event_open
电话。 这将包含可从mmap
环形缓冲区读取的PERF_RECORD_SAMPLE
事件的结构中的ip
字段。 有关详细信息,请参见手册页。
PERF_RECORD_SAMPLE
This record indicates a sample.
struct {
struct perf_event_header header;
u64 sample_id; /* if PERF_SAMPLE_IDENTIFIER */
u64 ip; /* if PERF_SAMPLE_IP */
u32 pid, tid; /* if PERF_SAMPLE_TID */
u64 time; /* if PERF_SAMPLE_TIME */
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.