File: perfmon_pebs_smpl.h

package info (click to toggle)
papi 5.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 28,064 kB
  • ctags: 38,805
  • sloc: ansic: 404,236; makefile: 3,440; fortran: 3,282; xml: 2,460; sh: 821; python: 515; perl: 269; asm: 24
file content (166 lines) | stat: -rw-r--r-- 4,665 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
 * Copyright (c) 2009 Google, Inc
 * Contributed by Stephane Eranian <eranian@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307 USA
 *
 */
#ifndef __PERFMON_PEBS_SMPL_H__
#define __PERFMON_PEBS_SMPL_H__ 1

/*
 * The 32-bit and 64-bit formats are identical, thus we use only
 * one name for the format.
 */
#define PFM_PEBS_SMPL_NAME	"pebs"

#define PFM_PEBS_NUM_CNT_RESET	8
/*
 * format specific parameters (passed at context creation)
 *
 * intr_thres: index from start of buffer of entry where the
 * PMU interrupt must be triggered. It must be several samples
 * short of the end of the buffer.
 */
typedef struct {
	uint64_t buf_size;		/* size of the PEBS buffer in bytes */
	uint64_t cnt_reset[PFM_PEBS_NUM_CNT_RESET];/* counter reset values */
	uint64_t reserved2[23];		/* for future use */
} pfm_pebs_smpl_arg_t;

/*
 * This header is at the beginning of the sampling buffer returned to the user.
 *
 * Because of PEBS alignement constraints, the actual PEBS buffer area does
 * not necessarily begin right after the header. The hdr_start_offs must be
 * used to compute the first byte of the buffer. The offset is defined as
 * the number of bytes between the end of the header and the beginning of
 * the buffer. As such the formula is:
 * 	actual_buffer = (unsigned long)(hdr+1)+hdr->hdr_start_offs
 */
typedef struct {
	uint64_t overflows;		/* #overflows for buffer */
	uint64_t count;			/* number of valid samples */
	uint64_t buf_size;		/* total buffer size */
	uint64_t pebs_size;		/* pebs buffer size */
	uint32_t version;		/* smpl format version */
	uint32_t entry_size;		/* pebs sample size */
	uint64_t reserved2[11];		/* for future use */
} pfm_pebs_smpl_hdr_t;

/*
 * Sample format as mandated by Intel documentation.
 * The same format is used in both 32 and 64 bit modes.
 */
typedef struct {
	uint64_t	eflags;
	uint64_t	ip;
	uint64_t	eax;
	uint64_t	ebx;
	uint64_t	ecx;
	uint64_t	edx;
	uint64_t	esi;
	uint64_t	edi;
	uint64_t	ebp;
	uint64_t	esp;
	uint64_t	r8;	/* 0 in 32-bit mode */
	uint64_t	r9;	/* 0 in 32-bit mode */
	uint64_t	r10;	/* 0 in 32-bit mode */
	uint64_t	r11;	/* 0 in 32-bit mode */
	uint64_t	r12;	/* 0 in 32-bit mode */
	uint64_t	r13;	/* 0 in 32-bit mode */
	uint64_t	r14;	/* 0 in 32-bit mode */
	uint64_t	r15;	/* 0 in 32-bit mode */
} pfm_pebs_core_smpl_entry_t; 

/*
 * Sample format as mandated by Intel documentation.
 * The same format is used in both 32 and 64 bit modes.
 */
typedef struct {
	uint64_t	eflags;
	uint64_t	ip;
	uint64_t	eax;
	uint64_t	ebx;
	uint64_t	ecx;
	uint64_t	edx;
	uint64_t	esi;
	uint64_t	edi;
	uint64_t	ebp;
	uint64_t	esp;
	uint64_t	r8;	/* 0 in 32-bit mode */
	uint64_t	r9;	/* 0 in 32-bit mode */
	uint64_t	r10;	/* 0 in 32-bit mode */
	uint64_t	r11;	/* 0 in 32-bit mode */
	uint64_t	r12;	/* 0 in 32-bit mode */
	uint64_t	r13;	/* 0 in 32-bit mode */
	uint64_t	r14;	/* 0 in 32-bit mode */
	uint64_t	r15;	/* 0 in 32-bit mode */
	uint64_t	ia32_perf_global_status;
	uint64_t	daddr;
	uint64_t	dsrc_enc;
	uint64_t	latency;
} pfm_pebs_nhm_smpl_entry_t; 

/*
 * 64-bit PEBS record format is described in
 * http://www.intel.com/technology/64bitextensions/30083502.pdf
 *
 * The format does not peek at samples. The sample structure is only
 * used to ensure that the buffer is large enough to accomodate one
 * sample.
 */
#ifdef __i386__
typedef struct {
	uint32_t	eflags;
	uint32_t	ip;
	uint32_t	eax;
	uint32_t	ebx;
	uint32_t	ecx;
	uint32_t	edx;
	uint32_t	esi;
	uint32_t	edi;
	uint32_t	ebp;
	uint32_t	esp;
} pfm_pebs_p4_smpl_entry_t;
#else
typedef struct {
	uint64_t	eflags;
	uint64_t	ip;
	uint64_t	eax;
	uint64_t	ebx;
	uint64_t	ecx;
	uint64_t	edx;
	uint64_t	esi;
	uint64_t	edi;
	uint64_t	ebp;
	uint64_t	esp;
	uint64_t	r8;
	uint64_t	r9;
	uint64_t	r10;
	uint64_t	r11;
	uint64_t	r12;
	uint64_t	r13;
	uint64_t	r14;
	uint64_t	r15;
} pfm_pebs_p4_smpl_entry_t;
#endif

#define PFM_PEBS_SMPL_VERSION_MAJ 1U
#define PFM_PEBS_SMPL_VERSION_MIN 0U
#define PFM_PEBS_SMPL_VERSION (((PFM_PEBS_SMPL_VERSION_MAJ&0xffff)<<16)|\
				   (PFM_PEBS_SMPL_VERSION_MIN & 0xffff))

#endif /* __PERFMON_PEBS_SMPL_H__ */