tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
Source file repositories/reference/linux-study-clean/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c- Extension
.c- Size
- 113834 bytes
- Lines
- 4516
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdlib.hstdbool.hstring.herrno.hstdint.hinttypes.hlinux/compiler.hlinux/string.hlinux/zalloc.h../auxtrace.hintel-pt-insn-decoder.hintel-pt-pkt-decoder.hintel-pt-decoder.hintel-pt-log.h
Detected Declarations
struct intel_pt_blkstruct intel_pt_stackstruct intel_pt_decoderstruct intel_pt_pkt_infostruct intel_pt_calc_cyc_to_tsc_infostruct eptw_datastruct intel_pt_vm_tsc_infostruct intel_pt_ovf_fup_infostruct intel_pt_psb_infostruct fast_forward_dataenum intel_pt_p_onceenum intel_pt_pkt_statefunction intel_pt_sample_timefunction intel_pt_lower_power_of_2function p_logfunction intel_pt_print_oncefunction intel_pt_cyc_thresholdfunction intel_pt_setup_periodfunction multdivfunction intel_pt_set_first_timestampfunction intel_pt_pop_blkfunction intel_pt_popfunction intel_pt_alloc_blkfunction intel_pt_pushfunction intel_pt_clear_stackfunction intel_pt_free_stackfunction intel_pt_decoder_freefunction intel_pt_ext_errfunction intel_pt__strerrorfunction intel_pt_calc_ipfunction intel_pt_set_last_ipfunction intel_pt_set_ipfunction intel_pt_decoder_log_packetfunction intel_pt_bugfunction intel_pt_clear_tx_flagsfunction intel_pt_update_in_txfunction intel_pt_update_pipfunction intel_pt_update_nrfunction intel_pt_set_nrfunction intel_pt_set_pipfunction intel_pt_bad_packetfunction intel_pt_update_sample_timefunction intel_pt_repositionfunction intel_pt_get_datafunction intel_pt_get_next_datafunction intel_pt_get_split_packetfunction intel_pt_pkt_lookaheadfunction intel_pt_fixup_last_mtc
Annotated Snippet
struct intel_pt_blk {
struct intel_pt_blk *prev;
uint64_t ip[INTEL_PT_BLK_SIZE];
};
struct intel_pt_stack {
struct intel_pt_blk *blk;
struct intel_pt_blk *spare;
int pos;
};
enum intel_pt_p_once {
INTEL_PT_PRT_ONCE_UNK_VMCS,
INTEL_PT_PRT_ONCE_ERANGE,
};
enum intel_pt_pkt_state {
INTEL_PT_STATE_NO_PSB,
INTEL_PT_STATE_NO_IP,
INTEL_PT_STATE_ERR_RESYNC,
INTEL_PT_STATE_IN_SYNC,
INTEL_PT_STATE_TNT_CONT,
INTEL_PT_STATE_TNT,
INTEL_PT_STATE_TIP,
INTEL_PT_STATE_TIP_PGD,
INTEL_PT_STATE_FUP,
INTEL_PT_STATE_FUP_NO_TIP,
INTEL_PT_STATE_FUP_IN_PSB,
INTEL_PT_STATE_RESAMPLE,
INTEL_PT_STATE_VM_TIME_CORRELATION,
};
static inline bool intel_pt_sample_time(enum intel_pt_pkt_state pkt_state)
{
switch (pkt_state) {
case INTEL_PT_STATE_NO_PSB:
case INTEL_PT_STATE_NO_IP:
case INTEL_PT_STATE_ERR_RESYNC:
case INTEL_PT_STATE_IN_SYNC:
case INTEL_PT_STATE_TNT_CONT:
case INTEL_PT_STATE_RESAMPLE:
case INTEL_PT_STATE_VM_TIME_CORRELATION:
return true;
case INTEL_PT_STATE_TNT:
case INTEL_PT_STATE_TIP:
case INTEL_PT_STATE_TIP_PGD:
case INTEL_PT_STATE_FUP:
case INTEL_PT_STATE_FUP_NO_TIP:
case INTEL_PT_STATE_FUP_IN_PSB:
return false;
default:
return true;
};
}
#ifdef INTEL_PT_STRICT
#define INTEL_PT_STATE_ERR1 INTEL_PT_STATE_NO_PSB
#define INTEL_PT_STATE_ERR2 INTEL_PT_STATE_NO_PSB
#define INTEL_PT_STATE_ERR3 INTEL_PT_STATE_NO_PSB
#define INTEL_PT_STATE_ERR4 INTEL_PT_STATE_NO_PSB
#else
#define INTEL_PT_STATE_ERR1 (decoder->pkt_state)
#define INTEL_PT_STATE_ERR2 INTEL_PT_STATE_NO_IP
#define INTEL_PT_STATE_ERR3 INTEL_PT_STATE_ERR_RESYNC
#define INTEL_PT_STATE_ERR4 INTEL_PT_STATE_IN_SYNC
#endif
struct intel_pt_decoder {
int (*get_trace)(struct intel_pt_buffer *buffer, void *data);
int (*walk_insn)(struct intel_pt_insn *intel_pt_insn,
uint64_t *insn_cnt_ptr, uint64_t *ip, uint64_t to_ip,
uint64_t max_insn_cnt, void *data);
bool (*pgd_ip)(uint64_t ip, void *data);
int (*lookahead)(void *data, intel_pt_lookahead_cb_t cb, void *cb_data);
struct intel_pt_vmcs_info *(*findnew_vmcs_info)(void *data, uint64_t vmcs);
void *data;
struct intel_pt_state state;
const unsigned char *buf;
size_t len;
bool return_compression;
bool branch_enable;
bool mtc_insn;
bool pge;
bool have_tma;
bool have_cyc;
bool fixup_last_mtc;
bool have_last_ip;
bool in_psb;
bool hop;
bool leap;
Annotation
- Immediate include surface: `stdlib.h`, `stdbool.h`, `string.h`, `errno.h`, `stdint.h`, `inttypes.h`, `linux/compiler.h`, `linux/string.h`.
- Detected declarations: `struct intel_pt_blk`, `struct intel_pt_stack`, `struct intel_pt_decoder`, `struct intel_pt_pkt_info`, `struct intel_pt_calc_cyc_to_tsc_info`, `struct eptw_data`, `struct intel_pt_vm_tsc_info`, `struct intel_pt_ovf_fup_info`, `struct intel_pt_psb_info`, `struct fast_forward_data`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.