|
Packit |
577717 |
#ifndef _PAPI_PERFMON_IA64_H
|
|
Packit |
577717 |
#define _PAPI_PERFMON_IA64_H
|
|
Packit |
577717 |
/*
|
|
Packit |
577717 |
* File: perfmon-ia64.h
|
|
Packit |
577717 |
* CVS: $Id$
|
|
Packit |
577717 |
* Author: Philip Mucci
|
|
Packit |
577717 |
* mucci@cs.utk.edu
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* Kevin London
|
|
Packit |
577717 |
* london@cs.utk.edu
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* Mods: Per Ekman
|
|
Packit |
577717 |
* pek@pdc.kth.se
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include <stdio.h>
|
|
Packit |
577717 |
#include <stdlib.h>
|
|
Packit |
577717 |
#include <stdarg.h>
|
|
Packit |
577717 |
#include <unistd.h>
|
|
Packit |
577717 |
#include <assert.h>
|
|
Packit |
577717 |
#include <errno.h>
|
|
Packit |
577717 |
#include <string.h>
|
|
Packit |
577717 |
#include <math.h>
|
|
Packit |
577717 |
#include <limits.h>
|
|
Packit |
577717 |
#include <time.h>
|
|
Packit |
577717 |
#include <fcntl.h>
|
|
Packit |
577717 |
#include <ctype.h>
|
|
Packit |
577717 |
#include <inttypes.h>
|
|
Packit |
577717 |
#include <libgen.h>
|
|
Packit |
577717 |
#include <sys/syscall.h>
|
|
Packit |
577717 |
#include <sys/types.h>
|
|
Packit |
577717 |
#include <sys/time.h>
|
|
Packit |
577717 |
#include <sys/times.h>
|
|
Packit |
577717 |
#include <sys/ucontext.h>
|
|
Packit |
577717 |
#include <sys/types.h>
|
|
Packit |
577717 |
#include <sys/ipc.h>
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#if defined(HAVE_MMTIMER)
|
|
Packit |
577717 |
#include <sys/ioctl.h>
|
|
Packit |
577717 |
#include <sys/mman.h>
|
|
Packit |
577717 |
#include <linux/mmtimer.h>
|
|
Packit |
577717 |
#ifndef MMTIMER_FULLNAME
|
|
Packit |
577717 |
#define MMTIMER_FULLNAME "/dev/mmtimer"
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifdef __INTEL_COMPILER
|
|
Packit |
577717 |
#include <ia64intrin.h>
|
|
Packit |
577717 |
#include <ia64regs.h>
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "papi_defines.h"
|
|
Packit |
577717 |
#include "config.h"
|
|
Packit |
577717 |
#include "perfmon/pfmlib.h"
|
|
Packit |
577717 |
#include "perfmon/perfmon.h"
|
|
Packit |
577717 |
#include "perfmon/perfmon_default_smpl.h"
|
|
Packit |
577717 |
#include "perfmon/pfmlib_montecito.h"
|
|
Packit |
577717 |
#include "perfmon/pfmlib_itanium2.h"
|
|
Packit |
577717 |
#include "perfmon/pfmlib_itanium.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef int ia64_register_t;
|
|
Packit |
577717 |
typedef int ia64_register_map_t;
|
|
Packit |
577717 |
typedef int ia64_reg_alloc_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define NUM_PMCS PFMLIB_MAX_PMCS
|
|
Packit |
577717 |
#define NUM_PMDS PFMLIB_MAX_PMDS
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct param_t
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
pfarg_reg_t pd[NUM_PMDS];
|
|
Packit |
577717 |
pfarg_reg_t pc[NUM_PMCS];
|
|
Packit |
577717 |
pfmlib_input_param_t inp;
|
|
Packit |
577717 |
pfmlib_output_param_t outp;
|
|
Packit |
577717 |
void *mod_inp; /* model specific input parameters to libpfm */
|
|
Packit |
577717 |
void *mod_outp; /* model specific output parameters from libpfm */
|
|
Packit |
577717 |
} pfmw_param_t;
|
|
Packit |
577717 |
// #ifdef ITANIUM3
|
|
Packit |
577717 |
typedef struct mont_param_t
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
pfmlib_mont_input_param_t mont_input_param;
|
|
Packit |
577717 |
pfmlib_mont_output_param_t mont_output_param;
|
|
Packit |
577717 |
} pfmw_mont_param_t;
|
|
Packit |
577717 |
// typedef pfmw_mont_param_t pfmw_ita_param_t;
|
|
Packit |
577717 |
// #elif defined(ITANIUM2)
|
|
Packit |
577717 |
typedef struct ita2_param_t
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
pfmlib_ita2_input_param_t ita2_input_param;
|
|
Packit |
577717 |
pfmlib_ita2_output_param_t ita2_output_param;
|
|
Packit |
577717 |
} pfmw_ita2_param_t;
|
|
Packit |
577717 |
// typedef pfmw_ita2_param_t pfmw_ita_param_t;
|
|
Packit |
577717 |
// #else
|
|
Packit |
577717 |
typedef int pfmw_ita1_param_t;
|
|
Packit |
577717 |
// #endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define PMU_FIRST_COUNTER 4
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef union
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
pfmw_ita1_param_t ita_param;
|
|
Packit |
577717 |
pfmw_ita2_param_t ita2_param;
|
|
Packit |
577717 |
pfmw_mont_param_t mont_param;
|
|
Packit |
577717 |
} pfmw_ita_param_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define MAX_COUNTERS 12
|
|
Packit |
577717 |
#define MAX_COUNTER_TERMS MAX_COUNTERS
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct ia64_control_state
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
/* Which counters to use? Bits encode counters to use, may be duplicates */
|
|
Packit |
577717 |
ia64_register_map_t bits;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
pfmw_ita_param_t ita_lib_param;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Buffer to pass to kernel to control the counters */
|
|
Packit |
577717 |
pfmw_param_t evt;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
long long counters[MAX_COUNTERS];
|
|
Packit |
577717 |
pfarg_reg_t pd[NUM_PMDS];
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* sampling buffer address */
|
|
Packit |
577717 |
void *smpl_vaddr;
|
|
Packit |
577717 |
/* Buffer to pass to library to control the counters */
|
|
Packit |
577717 |
} ia64_control_state_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct itanium_preset_search
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
/* Preset code */
|
|
Packit |
577717 |
int preset;
|
|
Packit |
577717 |
/* Derived code */
|
|
Packit |
577717 |
int derived;
|
|
Packit |
577717 |
/* Strings to look for */
|
|
Packit |
577717 |
char *( findme[MAX_COUNTERS] );
|
|
Packit |
577717 |
char operation[MAX_COUNTERS * 5];
|
|
Packit |
577717 |
} itanium_preset_search_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int fd; /* file descriptor */
|
|
Packit |
577717 |
pid_t tid; /* thread id */
|
|
Packit |
577717 |
#if defined(USE_PROC_PTTIMER)
|
|
Packit |
577717 |
int stat_fd;
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
} ia64_context_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#undef hwd_context_t
|
|
Packit |
577717 |
typedef ia64_context_t hwd_context_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "linux-context.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
//#undef hwd_ucontext_t
|
|
Packit |
577717 |
//typedef struct sigcontext hwd_ucontext_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Override void* definitions from PAPI framework layer */
|
|
Packit |
577717 |
/* with typedefs to conform to PAPI component layer code. */
|
|
Packit |
577717 |
#undef hwd_reg_alloc_t
|
|
Packit |
577717 |
typedef ia64_reg_alloc_t hwd_reg_alloc_t;
|
|
Packit |
577717 |
#undef hwd_register_t
|
|
Packit |
577717 |
typedef ia64_register_t hwd_register_t;
|
|
Packit |
577717 |
#undef hwd_control_state_t
|
|
Packit |
577717 |
typedef ia64_control_state_t hwd_control_state_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define SMPL_BUF_NENTRIES 64
|
|
Packit |
577717 |
#define M_PMD(x) (1UL<<(x))
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define MONT_DEAR_REGS_MASK (M_PMD(32)|M_PMD(33)|M_PMD(36))
|
|
Packit |
577717 |
#define MONT_ETB_REGS_MASK (M_PMD(38)| M_PMD(39)| \
|
|
Packit |
577717 |
M_PMD(48)|M_PMD(49)|M_PMD(50)|M_PMD(51)|M_PMD(52)|M_PMD(53)|M_PMD(54)|M_PMD(55)|\
|
|
Packit |
577717 |
M_PMD(56)|M_PMD(57)|M_PMD(58)|M_PMD(59)|M_PMD(60)|M_PMD(61)|M_PMD(62)|M_PMD(63))
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define DEAR_REGS_MASK (M_PMD(2)|M_PMD(3)|M_PMD(17))
|
|
Packit |
577717 |
#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))
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#endif /* _PAPI_PERFMON_IA64_H */
|