[英]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.