PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
perfmon-ia64.h
Go to the documentation of this file.
1 #ifndef _PAPI_PERFMON_IA64_H
2 #define _PAPI_PERFMON_IA64_H
3 /*
4 * File: perfmon-ia64.h
5 * CVS: $Id$
6 * Author: Philip Mucci
7 * mucci@cs.utk.edu
8 *
9 * Kevin London
10 * london@cs.utk.edu
11 *
12 * Mods: Per Ekman
13 * pek@pdc.kth.se
14 */
15 
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <stdarg.h>
19 #include <unistd.h>
20 #include <assert.h>
21 #include <errno.h>
22 #include <string.h>
23 #include <math.h>
24 #include <limits.h>
25 #include <time.h>
26 #include <fcntl.h>
27 #include <ctype.h>
28 #include <inttypes.h>
29 #include <libgen.h>
30 #include <sys/syscall.h>
31 #include <sys/types.h>
32 #include <sys/time.h>
33 #include <sys/times.h>
34 #include <sys/ucontext.h>
35 #include <sys/types.h>
36 #include <sys/ipc.h>
37 
38 #if defined(HAVE_MMTIMER)
39 #include <sys/ioctl.h>
40 #include <sys/mman.h>
41 #include <linux/mmtimer.h>
42 #ifndef MMTIMER_FULLNAME
43 #define MMTIMER_FULLNAME "/dev/mmtimer"
44 #endif
45 #endif
46 
47 #ifdef __INTEL_COMPILER
48 #include <ia64intrin.h>
49 #include <ia64regs.h>
50 #endif
51 
52 #include "papi_defines.h"
53 #include "config.h"
54 #include "perfmon/pfmlib.h"
55 #include "perfmon/perfmon.h"
56 #include "perfmon/perfmon_default_smpl.h"
57 #include "perfmon/pfmlib_montecito.h"
58 #include "perfmon/pfmlib_itanium2.h"
59 #include "perfmon/pfmlib_itanium.h"
60 
61 typedef int ia64_register_t;
62 typedef int ia64_register_map_t;
63 typedef int ia64_reg_alloc_t;
64 
65 
66 #define NUM_PMCS PFMLIB_MAX_PMCS
67 #define NUM_PMDS PFMLIB_MAX_PMDS
68 
69 typedef struct param_t
70 {
71  pfarg_reg_t pd[NUM_PMDS];
72  pfarg_reg_t pc[NUM_PMCS];
73  pfmlib_input_param_t inp;
74  pfmlib_output_param_t outp;
75  void *mod_inp; /* model specific input parameters to libpfm */
76  void *mod_outp; /* model specific output parameters from libpfm */
77 } pfmw_param_t;
78 // #ifdef ITANIUM3
79 typedef struct mont_param_t
80 {
81  pfmlib_mont_input_param_t mont_input_param;
82  pfmlib_mont_output_param_t mont_output_param;
84 // typedef pfmw_mont_param_t pfmw_ita_param_t;
85 // #elif defined(ITANIUM2)
86 typedef struct ita2_param_t
87 {
88  pfmlib_ita2_input_param_t ita2_input_param;
89  pfmlib_ita2_output_param_t ita2_output_param;
91 // typedef pfmw_ita2_param_t pfmw_ita_param_t;
92 // #else
93 typedef int pfmw_ita1_param_t;
94 // #endif
95 
96 #define PMU_FIRST_COUNTER 4
97 
98 typedef union
99 {
104 
105 
106 #define MAX_COUNTERS 12
107 #define MAX_COUNTER_TERMS MAX_COUNTERS
108 
109 typedef struct ia64_control_state
110 {
111  /* Which counters to use? Bits encode counters to use, may be duplicates */
113 
115 
116  /* Buffer to pass to kernel to control the counters */
118 
119  long long counters[MAX_COUNTERS];
120  pfarg_reg_t pd[NUM_PMDS];
121 
122 /* sampling buffer address */
123  void *smpl_vaddr;
124  /* Buffer to pass to library to control the counters */
126 
127 
128 typedef struct itanium_preset_search
129 {
130  /* Preset code */
131  int preset;
132  /* Derived code */
133  int derived;
134  /* Strings to look for */
135  char *( findme[MAX_COUNTERS] );
136  char operation[MAX_COUNTERS * 5];
138 
139 typedef struct
140 {
141  int fd; /* file descriptor */
142  pid_t tid; /* thread id */
143 #if defined(USE_PROC_PTTIMER)
144  int stat_fd;
145 #endif
147 
148 #undef hwd_context_t
150 
151 #include "linux-context.h"
152 
153 //#undef hwd_ucontext_t
154 //typedef struct sigcontext hwd_ucontext_t;
155 
156 /* Override void* definitions from PAPI framework layer */
157 /* with typedefs to conform to PAPI component layer code. */
158 #undef hwd_reg_alloc_t
160 #undef hwd_register_t
162 #undef hwd_control_state_t
164 
165 #define SMPL_BUF_NENTRIES 64
166 #define M_PMD(x) (1UL<<(x))
167 
168 #define MONT_DEAR_REGS_MASK (M_PMD(32)|M_PMD(33)|M_PMD(36))
169 #define MONT_ETB_REGS_MASK (M_PMD(38)| M_PMD(39)| \
170  M_PMD(48)|M_PMD(49)|M_PMD(50)|M_PMD(51)|M_PMD(52)|M_PMD(53)|M_PMD(54)|M_PMD(55)|\
171  M_PMD(56)|M_PMD(57)|M_PMD(58)|M_PMD(59)|M_PMD(60)|M_PMD(61)|M_PMD(62)|M_PMD(63))
172 
173 #define DEAR_REGS_MASK (M_PMD(2)|M_PMD(3)|M_PMD(17))
174 #define BTB_REGS_MASK (M_PMD(8)|M_PMD(9)|M_PMD(10)|M_PMD(11)|M_PMD(12)|M_PMD(13)|M_PMD(14)|M_PMD(15)|M_PMD(16))
175 
176 #endif /* _PAPI_PERFMON_IA64_H */
pfmlib_input_param_t inp
Definition: perfmon-ia64.h:73
pfmw_ita_param_t ita_lib_param
Definition: perfmon-ia64.h:114
pfmlib_output_param_t outp
Definition: perfmon-ia64.h:74
#define hwd_control_state_t
#define hwd_reg_alloc_t
int ia64_reg_alloc_t
Definition: perfmon-ia64.h:63
pfmw_ita1_param_t ita_param
Definition: perfmon-ia64.h:100
pfmlib_mont_input_param_t mont_input_param
Definition: perfmon-ia64.h:81
int ia64_register_map_t
Definition: perfmon-ia64.h:62
#define NUM_PMCS
Definition: perfmon-ia64.h:66
void * mod_outp
Definition: perfmon-ia64.h:76
#define MAX_COUNTERS
Definition: perfmon-ia64.h:106
ia64_register_map_t bits
Definition: perfmon-ia64.h:112
#define hwd_context_t
int pfmw_ita1_param_t
Definition: perfmon-ia64.h:93
pfmw_ita2_param_t ita2_param
Definition: perfmon-ia64.h:101
pfmlib_ita2_output_param_t ita2_output_param
Definition: perfmon-ia64.h:89
pfmlib_ita2_input_param_t ita2_input_param
Definition: perfmon-ia64.h:88
#define NUM_PMDS
Definition: perfmon-ia64.h:67
pfmlib_mont_output_param_t mont_output_param
Definition: perfmon-ia64.h:82
int ia64_register_t
Definition: perfmon-ia64.h:61
pfmw_mont_param_t mont_param
Definition: perfmon-ia64.h:102
#define hwd_register_t
void * mod_inp
Definition: perfmon-ia64.h:75