Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __PERFMON_H__
00011 #define __PERFMON_H__
00012
00013 #include <sys/types.h>
00014 #include <stdint.h>
00015
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019
00020 #ifdef __ia64__
00021 #include <perfmon/perfmon_ia64.h>
00022 #endif
00023
00024 #ifdef __x86_64__
00025 #include <perfmon/perfmon_x86_64.h>
00026 #endif
00027
00028 #ifdef __i386__
00029 #include <perfmon/perfmon_i386.h>
00030 #endif
00031
00032 #if defined(__powerpc__) || defined(__cell__)
00033 #include <perfmon/perfmon_powerpc.h>
00034 #endif
00035
00036 #ifdef __sparc__
00037 #include <perfmon/perfmon_sparc.h>
00038 #endif
00039
00040 #ifdef __mips__
00041 #include <perfmon/perfmon_mips64.h>
00042 #endif
00043
00044 #ifdef __crayx2
00045 #include <perfmon/perfmon_crayx2.h>
00046 #endif
00047
00048 #define PFM_MAX_PMCS PFM_ARCH_MAX_PMCS
00049 #define PFM_MAX_PMDS PFM_ARCH_MAX_PMDS
00050
00051 #ifndef SWIG
00052
00053
00054
00055 #define PFM_BPL (sizeof(uint64_t)<<3)
00056 #define PFM_BVSIZE(x) (((x)+PFM_BPL-1) / PFM_BPL)
00057 #define PFM_PMD_BV PFM_BVSIZE(PFM_MAX_PMDS)
00058 #define PFM_PMC_BV PFM_BVSIZE(PFM_MAX_PMCS)
00059 #endif
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 typedef int os_err_t;
00070
00071
00072
00073
00074
00075 typedef struct {
00076 uint64_t sif_avail_pmcs[PFM_PMC_BV];
00077 uint64_t sif_avail_pmds[PFM_PMD_BV];
00078 uint64_t sif_reserved[4];
00079 } pfarg_sinfo_t;
00080
00081
00082
00083 extern os_err_t pfm_create(int flags, pfarg_sinfo_t *sif, ...);
00084
00085
00086
00087
00088
00089
00090
00091 #define PFM_FL_NOTIFY_BLOCK 0x01
00092 #define PFM_FL_SYSTEM_WIDE 0x02
00093 #define PFM_FL_SMPL_FMT 0x04
00094 #define PFM_FL_OVFL_NO_MSG 0x80
00095
00096
00097
00098
00099 typedef struct {
00100 uint16_t reg_num;
00101 uint16_t reg_set;
00102 uint32_t reg_flags;
00103 uint64_t reg_value;
00104 } pfarg_pmr_t;
00105
00106
00107
00108
00109
00110
00111
00112
00113 #define PFM_REGFL_OVFL_NOTIFY 0x1
00114 #define PFM_REGFL_RANDOM 0x2
00115 #define PFM_REGFL_NO_EMUL64 0x4
00116
00117
00118
00119
00120
00121
00122 typedef struct {
00123 uint16_t reg_num;
00124 uint16_t reg_set;
00125 uint32_t reg_flags;
00126 uint64_t reg_value;
00127 uint64_t reg_long_reset;
00128 uint64_t reg_short_reset;
00129 uint64_t reg_random_mask;
00130 uint64_t reg_smpl_pmds[PFM_PMD_BV];
00131 uint64_t reg_reset_pmds[PFM_PMD_BV];
00132 uint64_t reg_ovfl_swcnt;
00133 uint64_t reg_smpl_eventid;
00134 uint64_t reg_last_value;
00135 uint64_t reg_reserved[8];
00136 } pfarg_pmd_attr_t;
00137
00138
00139
00140
00141
00142 #define PFM_RW_PMD 1
00143 #define PFM_RW_PMC 2
00144 #define PFM_RW_PMD_ATTR 3
00145
00146
00147
00148
00149 #define PFM_NO_TARGET -1
00150
00151
00152
00153
00154
00155 #define PFM_ST_START 0x1
00156 #define PFM_ST_STOP 0x2
00157 #define PFM_ST_RESTART 0x3
00158
00159 #ifndef PFMLIB_OLD_PFMV2
00160 typedef struct {
00161 uint16_t set_id;
00162 uint16_t set_reserved1;
00163 uint32_t set_flags;
00164 uint64_t set_timeout;
00165 uint64_t reserved[6];
00166 } pfarg_set_desc_t;
00167
00168 typedef struct {
00169 uint16_t set_id;
00170 uint16_t set_reserved1;
00171 uint32_t set_reserved2;
00172 uint64_t set_ovfl_pmds[PFM_PMD_BV];
00173 uint64_t set_runs;
00174 uint64_t set_timeout;
00175 uint64_t set_duration;
00176 uint64_t set_reserved3[4];
00177 } pfarg_set_info_t;
00178 #endif
00179
00180
00181
00182
00183 #define PFM_SETFL_OVFL_SWITCH 0x01
00184 #define PFM_SETFL_TIME_SWITCH 0x02
00185
00186 #ifndef PFMLIB_OLD_PFMV2
00187 typedef struct {
00188 uint32_t msg_type;
00189 uint32_t msg_ovfl_pid;
00190 uint16_t msg_active_set;
00191 uint16_t msg_ovfl_cpu;
00192 uint32_t msg_ovfl_tid;
00193 uint64_t msg_ovfl_ip;
00194 uint64_t msg_ovfl_pmds[PFM_PMD_BV];
00195 } pfarg_ovfl_msg_t;
00196
00197 extern os_err_t pfm_write(int fd, int flags, int type, void *reg, size_t n);
00198 extern os_err_t pfm_read(int fd, int flags, int type, void *reg, size_t n);
00199 extern os_err_t pfm_set_state(int fd, int flags, int state);
00200 extern os_err_t pfm_create_sets(int fd, int flags, pfarg_set_desc_t *s, size_t sz);
00201 extern os_err_t pfm_getinfo_sets(int fd, int flags, pfarg_set_info_t *s, size_t sz);
00202 extern os_err_t pfm_attach(int fd, int flags, int target);
00203
00204 #endif
00205
00206 #include "perfmon_v2.h"
00207
00208 typedef union {
00209 uint32_t type;
00210 pfarg_ovfl_msg_t pfm_ovfl_msg;
00211 } pfarg_msg_t;
00212
00213 #define PFM_MSG_OVFL 1
00214 #define PFM_MSG_END 2
00215
00216 #define PFM_VERSION_MAJOR(x) (((x)>>16) & 0xffff)
00217 #define PFM_VERSION_MINOR(x) ((x) & 0xffff)
00218
00219 #ifdef __cplusplus
00220 };
00221 #endif
00222
00223 #endif