The Gaudi Framework  v30r3 (a5ef0a68)
perfmon_pebs_smpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 Google, Inc
3  * Contributed by Stephane Eranian <eranian@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public
7  * License as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17  * 02111-1307 USA
18  *
19  */
20 #ifndef __PERFMON_PEBS_SMPL_H__
21 #define __PERFMON_PEBS_SMPL_H__ 1
22 
23 /*
24  * The 32-bit and 64-bit formats are identical, thus we use only
25  * one name for the format.
26  */
27 #define PFM_PEBS_SMPL_NAME "pebs"
28 
29 #define PFM_PEBS_NUM_CNT_RESET 8
30 /*
31  * format specific parameters (passed at context creation)
32  *
33  * intr_thres: index from start of buffer of entry where the
34  * PMU interrupt must be triggered. It must be several samples
35  * short of the end of the buffer.
36  */
37 typedef struct {
38  uint64_t buf_size; /* size of the PEBS buffer in bytes */
39  uint64_t cnt_reset[PFM_PEBS_NUM_CNT_RESET]; /* counter reset values */
40  uint64_t reserved2[23]; /* for future use */
42 
43 /*
44  * This header is at the beginning of the sampling buffer returned to the user.
45  *
46  * Because of PEBS alignement constraints, the actual PEBS buffer area does
47  * not necessarily begin right after the header. The hdr_start_offs must be
48  * used to compute the first byte of the buffer. The offset is defined as
49  * the number of bytes between the end of the header and the beginning of
50  * the buffer. As such the formula is:
51  * actual_buffer = (unsigned long)(hdr+1)+hdr->hdr_start_offs
52  */
53 typedef struct {
54  uint64_t overflows; /* #overflows for buffer */
55  uint64_t count; /* number of valid samples */
56  uint64_t buf_size; /* total buffer size */
57  uint64_t pebs_size; /* pebs buffer size */
58  uint32_t version; /* smpl format version */
59  uint32_t entry_size; /* pebs sample size */
60  uint64_t reserved2[11]; /* for future use */
62 
63 /*
64  * Sample format as mandated by Intel documentation.
65  * The same format is used in both 32 and 64 bit modes.
66  */
67 typedef struct {
68  uint64_t eflags;
69  uint64_t ip;
70  uint64_t eax;
71  uint64_t ebx;
72  uint64_t ecx;
73  uint64_t edx;
74  uint64_t esi;
75  uint64_t edi;
76  uint64_t ebp;
77  uint64_t esp;
78  uint64_t r8; /* 0 in 32-bit mode */
79  uint64_t r9; /* 0 in 32-bit mode */
80  uint64_t r10; /* 0 in 32-bit mode */
81  uint64_t r11; /* 0 in 32-bit mode */
82  uint64_t r12; /* 0 in 32-bit mode */
83  uint64_t r13; /* 0 in 32-bit mode */
84  uint64_t r14; /* 0 in 32-bit mode */
85  uint64_t r15; /* 0 in 32-bit mode */
87 
88 /*
89  * Sample format as mandated by Intel documentation.
90  * The same format is used in both 32 and 64 bit modes.
91  */
92 typedef struct {
103  uint64_t r8; /* 0 in 32-bit mode */
104  uint64_t r9; /* 0 in 32-bit mode */
105  uint64_t r10; /* 0 in 32-bit mode */
106  uint64_t r11; /* 0 in 32-bit mode */
107  uint64_t r12; /* 0 in 32-bit mode */
108  uint64_t r13; /* 0 in 32-bit mode */
109  uint64_t r14; /* 0 in 32-bit mode */
110  uint64_t r15; /* 0 in 32-bit mode */
116 
117 /*
118  * 64-bit PEBS record format is described in
119  * http://www.intel.com/technology/64bitextensions/30083502.pdf
120  *
121  * The format does not peek at samples. The sample structure is only
122  * used to ensure that the buffer is large enough to accomodate one
123  * sample.
124  */
125 #ifdef __i386__
126 typedef struct {
127  uint32_t eflags;
128  uint32_t ip;
129  uint32_t eax;
130  uint32_t ebx;
131  uint32_t ecx;
132  uint32_t edx;
133  uint32_t esi;
134  uint32_t edi;
135  uint32_t ebp;
136  uint32_t esp;
138 #else
139 typedef struct {
159 #endif
160 
161 #define PFM_PEBS_SMPL_VERSION_MAJ 1U
162 #define PFM_PEBS_SMPL_VERSION_MIN 0U
163 #define PFM_PEBS_SMPL_VERSION \
164  ( ( ( PFM_PEBS_SMPL_VERSION_MAJ & 0xffff ) << 16 ) | ( PFM_PEBS_SMPL_VERSION_MIN & 0xffff ) )
165 
166 #endif /* __PERFMON_PEBS_SMPL_H__ */
uint64_t eax
uint64_t r15
#define PFM_PEBS_NUM_CNT_RESET
uint64_t r9
uint64_t edi
uint64_t ebx
uint64_t edx
uint64_t dsrc_enc
uint64_t esp
uint64_t ebp
uint64_t r12
uint64_t ip
uint64_t r12
uint64_t r11
uint64_t ecx
uint64_t r10
unsigned long long uint64_t
Definition: instrset.h:143
uint64_t r11
uint64_t latency
uint64_t r13
uint64_t ebp
uint64_t edx
uint64_t r8
uint64_t esi
uint64_t r15
uint64_t esp
uint64_t eflags
uint64_t edi
uint64_t r13
uint64_t esi
uint64_t eflags
unsigned int uint32_t
Definition: instrset.h:141
uint64_t daddr
uint64_t ip
uint64_t ecx
uint64_t r14
uint64_t r14
uint64_t ia32_perf_global_status
uint64_t eax
uint64_t r10
uint64_t r8
uint64_t r9
uint64_t ebx