簡體   English   中英

性能記錄如何獲取目標進程的指令的虛擬內存地址以及性能用於存儲的數據結構

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

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM