Linux Perf
intel-pt-decoder.h
Go to the documentation of this file.
1 /*
2  * intel_pt_decoder.h: Intel Processor Trace support
3  * Copyright (c) 2013-2014, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  */
15 
16 #ifndef INCLUDE__INTEL_PT_DECODER_H__
17 #define INCLUDE__INTEL_PT_DECODER_H__
18 
19 #include <stdint.h>
20 #include <stddef.h>
21 #include <stdbool.h>
22 
23 #include "intel-pt-insn-decoder.h"
24 
25 #define INTEL_PT_IN_TX (1 << 0)
26 #define INTEL_PT_ABORT_TX (1 << 1)
27 #define INTEL_PT_ASYNC (1 << 2)
28 #define INTEL_PT_FUP_IP (1 << 3)
29 
31  INTEL_PT_BRANCH = 1 << 0,
34  INTEL_PT_PTW = 1 << 3,
37  INTEL_PT_EX_STOP = 1 << 6,
39  INTEL_PT_CBR_CHG = 1 << 8,
40 };
41 
47 };
48 
49 enum {
61 };
62 
64  /*
65  * FUP packet can contain next linear instruction pointer instead of
66  * current linear instruction pointer.
67  */
69 };
70 
73  int err;
74  uint64_t from_ip;
75  uint64_t to_ip;
76  uint64_t cr3;
77  uint64_t tot_insn_cnt;
78  uint64_t timestamp;
79  uint64_t est_timestamp;
80  uint64_t trace_nr;
81  uint64_t ptw_payload;
82  uint64_t mwait_payload;
83  uint64_t pwre_payload;
84  uint64_t pwrx_payload;
85  uint64_t cbr_payload;
86  uint32_t flags;
88  int insn_len;
90 };
91 
92 struct intel_pt_insn;
93 
95  const unsigned char *buf;
96  size_t len;
98  uint64_t ref_timestamp;
99  uint64_t trace_nr;
100 };
101 
103  int (*get_trace)(struct intel_pt_buffer *buffer, void *data);
104  int (*walk_insn)(struct intel_pt_insn *intel_pt_insn,
105  uint64_t *insn_cnt_ptr, uint64_t *ip, uint64_t to_ip,
106  uint64_t max_insn_cnt, void *data);
107  bool (*pgd_ip)(uint64_t ip, void *data);
108  void *data;
111  uint64_t period;
112  enum intel_pt_period_type period_type;
114  unsigned int mtc_period;
115  uint32_t tsc_ctc_ratio_n;
116  uint32_t tsc_ctc_ratio_d;
118 };
119 
120 struct intel_pt_decoder;
121 
123 void intel_pt_decoder_free(struct intel_pt_decoder *decoder);
124 
125 const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder);
126 
127 unsigned char *intel_pt_find_overlap(unsigned char *buf_a, size_t len_a,
128  unsigned char *buf_b, size_t len_b,
129  bool have_tsc, bool *consecutive);
130 
131 int intel_pt__strerror(int code, char *buf, size_t buflen);
132 
133 #endif
Definition: insn.h:36
uint32_t tsc_ctc_ratio_d
uint64_t cbr_payload
unsigned int mtc_period
uint64_t ptw_payload
const unsigned char * buf
intel_pt_insn_op
#define INTEL_PT_INSN_BUF_SZ
unsigned max_non_turbo_ratio
dictionary data
Definition: stat-cpi.py:4
uint64_t pwre_payload
enum intel_pt_insn_op insn_op
uint64_t pwrx_payload
uint64_t mwait_payload
uint64_t tot_insn_cnt
struct intel_pt_decoder * intel_pt_decoder_new(struct intel_pt_params *params)
intel_pt_period_type
enum intel_pt_sample_type type
void intel_pt_decoder_free(struct intel_pt_decoder *decoder)
intel_pt_sample_type
intel_pt_param_flags
uint64_t est_timestamp
Definition: numa.c:71
int intel_pt__strerror(int code, char *buf, size_t buflen)
unsigned char * intel_pt_find_overlap(unsigned char *buf_a, size_t len_a, unsigned char *buf_b, size_t len_b, bool have_tsc, bool *consecutive)
uint32_t tsc_ctc_ratio_n
const struct intel_pt_state * intel_pt_decode(struct intel_pt_decoder *decoder)
uint64_t ref_timestamp