1PT_PKT_ALLOC_DECODER(3) PT_PKT_ALLOC_DECODER(3)
2
3
4
6 pt_pkt_alloc_decoder, pt_pkt_free_decoder - allocate/free an Intel(R)
7 Processor Trace packet decoder
8
10 #include <intel-pt.h>
11 struct pt_packet_decoder *
12 pt_pkt_alloc_decoder(const struct pt_config *config);
13 void pt_pkt_free_decoder(struct pt_packet_decoder *decoder);
14
15 Link with -lipt.
16
18 pt_pkt_alloc_decoder() allocates a new Intel Processor Trace (Intel PT)
19 packet decoder and returns a pointer to it. The packet decoder decodes
20 raw Intel PT trace into a stream of pt_packet objects. See
21 pt_pkt_next(3).
22
23 The config argument points to a pt_config object. See pt_config(3).
24 The config argument will not be referenced by the returned decoder but
25 the trace buffer defined by the config argument's begin and end fields
26 will.
27
28 The returned packet decoder needs to be synchronized onto the trace
29 stream before it can be used. To synchronize the packet decoder, use
30 pt_pkt_sync_forward(3), pt_pkt_sync_backward(3), or pt_pkt_sync_set(3).
31
32 pt_pkt_free_decoder() frees the Intel PT packet decoder pointed to by
33 decoder. The decoder argument must be NULL or point to a decoder that
34 has been allocated by a call to pt_pkt_alloc_decoder().
35
37 pt_pkt_alloc_decoder() returns a pointer to a pt_packet_decoder object
38 on success or NULL in case of an error.
39
41 int foo(const struct pt_config *config) {
42 struct pt_packet_decoder *decoder;
43 errcode;
44
45 decoder = pt_pkt_alloc_decoder(config);
46 if (!decoder)
47 return pte_nomem;
48
49 errcode = bar(decoder);
50
51 pt_pkt_free_decoder(decoder);
52 return errcode;
53 }
54
56 pt_config(3), pt_pkt_sync_forward(3), pt_pkt_sync_backward(3),
57 pt_pkt_sync_set(3), pt_pkt_get_offset(3), pt_pkt_get_sync_offset(3),
58 pt_pkt_get_config(3), pt_pkt_next(3)
59
60
61
62 PT_PKT_ALLOC_DECODER(3)