]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - doc/man/pt_blk_alloc_decoder.3.md
Import Intel Processor Trace library.
[FreeBSD/FreeBSD.git] / doc / man / pt_blk_alloc_decoder.3.md
1 % PT_BLK_ALLOC_DECODER(3)
2
3 <!---
4  ! Copyright (c) 2016-2018, Intel Corporation
5  !
6  ! Redistribution and use in source and binary forms, with or without
7  ! modification, are permitted provided that the following conditions are met:
8  !
9  !  * Redistributions of source code must retain the above copyright notice,
10  !    this list of conditions and the following disclaimer.
11  !  * Redistributions in binary form must reproduce the above copyright notice,
12  !    this list of conditions and the following disclaimer in the documentation
13  !    and/or other materials provided with the distribution.
14  !  * Neither the name of Intel Corporation nor the names of its contributors
15  !    may be used to endorse or promote products derived from this software
16  !    without specific prior written permission.
17  !
18  ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  ! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  ! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  ! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  ! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  ! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  ! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  ! POSSIBILITY OF SUCH DAMAGE.
29  !-->
30
31 # NAME
32
33 pt_blk_alloc_decoder, pt_blk_free_decoder - allocate/free an Intel(R) Processor
34 Trace block decoder
35
36
37 # SYNOPSIS
38
39 | **\#include `<intel-pt.h>`**
40 |
41 | **struct pt_block_decoder \***
42 | **pt_blk_alloc_decoder(const struct pt_config \**config*);**
43 |
44 | **void pt_blk_free_decoder(struct pt_block_decoder \**decoder*);**
45
46 Link with *-lipt*.
47
48
49 # DESCRIPTION
50
51 A block decoder decodes raw Intel Processor Trace (Intel PT) into a sequence of
52 blocks of instructions described by the *pt_block* structure.  See
53 **pt_blk_next**(3).
54
55 **pt_blk_alloc_decoder**() allocates a new block decoder and returns a pointer
56 to it.  The *config* argument points to a *pt_config* object.  See
57 **pt_config**(3).  The *config* argument will not be referenced by the returned
58 decoder but the trace buffer defined by the *config* argument's *begin* and
59 *end* fields will.
60
61 The returned block decoder needs to be synchronized onto the trace stream before
62 it can be used.  To synchronize the decoder, use **pt_blk_sync_forward**(3),
63 **pt_blk_sync_backward**(3), or **pt_blk_sync_set**(3).
64
65 **pt_blk_free_decoder**() frees the Intel PT block decoder pointed to by
66 *decoder*.  The *decoder* argument must be NULL or point to a decoder that has
67 been allocated by a call to **pt_blk_alloc_decoder**().
68
69
70 # RETURN VALUE
71
72 **pt_blk_alloc_decoder**() returns a pointer to a *pt_block_decoder* object on
73 success or NULL in case of an error.
74
75
76 # EXAMPLE
77
78 ~~~{.c}
79     struct pt_block_decoder *decoder;
80     int errcode;
81
82     decoder = pt_blk_alloc_decoder(config);
83     if (!decoder)
84         return pte_nomem;
85
86     errcode = decode(decoder);
87
88     pt_blk_free_decoder(decoder);
89     return errcode;
90 ~~~
91
92
93 # SEE ALSO
94
95 **pt_config**(3), **pt_blk_sync_forward**(3), **pt_blk_sync_backward**(3),
96 **pt_blk_sync_set**(3), **pt_blk_get_offset**(3), **pt_blk_get_sync_offset**(3),
97 **pt_blk_get_image**(3), **pt_blk_set_image**(3), **pt_blk_get_config**(3),
98 **pt_blk_time**(3), **pt_blk_core_bus_ratio**(3), **pt_blk_next**(3)