|
Packit |
577717 |
/****************************/
|
|
Packit |
577717 |
/* THIS IS OPEN SOURCE CODE */
|
|
Packit |
577717 |
/****************************/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/**
|
|
Packit |
577717 |
* @file linux-bgq.h
|
|
Packit |
577717 |
* CVS: $Id$
|
|
Packit |
577717 |
* @author Heike Jagode
|
|
Packit |
577717 |
* jagode@eecs.utk.edu
|
|
Packit |
577717 |
* Mods: < your name here >
|
|
Packit |
577717 |
* < your email address >
|
|
Packit |
577717 |
* Blue Gene/Q CPU component: BGPM / Punit
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* Tested version of bgpm (early access)
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @brief
|
|
Packit |
577717 |
* This file has the source code for a component that enables PAPI-C to
|
|
Packit |
577717 |
* access hardware monitoring counters for BG/Q through the BGPM library.
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifndef _LINUX_BGQ_H
|
|
Packit |
577717 |
#define _LINUX_BGQ_H
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include <stdlib.h>
|
|
Packit |
577717 |
#include <stdio.h>
|
|
Packit |
577717 |
#include <string.h>
|
|
Packit |
577717 |
#include <unistd.h>
|
|
Packit |
577717 |
#include <sys/profil.h>
|
|
Packit |
577717 |
#include <assert.h>
|
|
Packit |
577717 |
#include <limits.h>
|
|
Packit |
577717 |
#include <signal.h>
|
|
Packit |
577717 |
#include <errno.h>
|
|
Packit |
577717 |
#include <sys/ucontext.h>
|
|
Packit |
577717 |
#include <stdarg.h>
|
|
Packit |
577717 |
#include <ctype.h>
|
|
Packit |
577717 |
//#include <pthread.h>
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "linux-bgq-common.h"
|
|
Packit |
577717 |
/* Header required to obtain BGQ personality */
|
|
Packit |
577717 |
#include "process_impl.h"
|
|
Packit |
577717 |
#include "linux-context.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* this number assumes that there will never be more events than indicated */
|
|
Packit |
577717 |
#define BGQ_PUNIT_MAX_COUNTERS UPC_P_NUM_COUNTERS
|
|
Packit |
577717 |
#define BGQ_PUNIT_MAX_EVENTS PEVT_PUNIT_LAST_EVENT
|
|
Packit |
577717 |
#define MAX_COUNTER_TERMS BGQ_PUNIT_MAX_COUNTERS
|
|
Packit |
577717 |
// keep a large enough gap between actual BGPM events and our local opcode events
|
|
Packit |
577717 |
#define OPCODE_BUF ( MAX_COUNTERS + MAX_COUNTERS )
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "papi.h"
|
|
Packit |
577717 |
#include "papi_preset.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int preset; /* Preset code */
|
|
Packit |
577717 |
int derived; /* Derived code */
|
|
Packit |
577717 |
char *( findme[MAX_COUNTER_TERMS] ); /* Strings to look for, more than 1 means derived */
|
|
Packit |
577717 |
char *operation; /* PostFix operations between terms */
|
|
Packit |
577717 |
char *note; /* In case a note is included with a preset */
|
|
Packit |
577717 |
} bgq_preset_search_entry_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
// Context structure not used...
|
|
Packit |
577717 |
typedef struct bgq_context
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int reserved;
|
|
Packit |
577717 |
} bgq_context_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct bgq_overflow
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int threshold;
|
|
Packit |
577717 |
int EventIndex;
|
|
Packit |
577717 |
} bgq_overflow_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
// Control state structure... Holds local copy of read counters...
|
|
Packit |
577717 |
typedef struct bgq_control_state
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int EventGroup;
|
|
Packit |
577717 |
int EventGroup_local[512];
|
|
Packit |
577717 |
int count;
|
|
Packit |
577717 |
long_long counters[BGQ_PUNIT_MAX_COUNTERS];
|
|
Packit |
577717 |
int muxOn; // multiplexing on or off flag
|
|
Packit |
577717 |
int overflow; // overflow enable
|
|
Packit |
577717 |
int overflow_count;
|
|
Packit |
577717 |
bgq_overflow_t overflow_list[512];
|
|
Packit |
577717 |
int bgpm_eventset_applied; // BGPM eventGroup applied yes or no flag
|
|
Packit |
577717 |
} bgq_control_state_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
// Register allocation structure
|
|
Packit |
577717 |
typedef struct bgq_reg_alloc
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
//_papi_hwd_bgq_native_event_id_t id;
|
|
Packit |
577717 |
} bgq_reg_alloc_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
// Register structure not used...
|
|
Packit |
577717 |
typedef struct bgq_register
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
/* This is used by the framework.It likes it to be !=0 to do something */
|
|
Packit |
577717 |
unsigned int selector;
|
|
Packit |
577717 |
/* This is the information needed to locate a BGPM / Punit event */
|
|
Packit |
577717 |
unsigned eventID;
|
|
Packit |
577717 |
} bgq_register_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** This structure is used to build the table of events */
|
|
Packit |
577717 |
typedef struct bgq_native_event_entry
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
bgq_register_t resources;
|
|
Packit |
577717 |
char name[PAPI_MAX_STR_LEN];
|
|
Packit |
577717 |
char description[PAPI_2MAX_STR_LEN];
|
|
Packit |
577717 |
} bgq_native_event_entry_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 |
#undef hwd_register_t
|
|
Packit |
577717 |
#undef hwd_control_state_t
|
|
Packit |
577717 |
#undef hwd_context_t
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef bgq_reg_alloc_t hwd_reg_alloc_t;
|
|
Packit |
577717 |
typedef bgq_register_t hwd_register_t;
|
|
Packit |
577717 |
typedef bgq_control_state_t hwd_control_state_t;
|
|
Packit |
577717 |
typedef bgq_context_t hwd_context_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
extern void _papi_hwd_lock( int );
|
|
Packit |
577717 |
extern void _papi_hwd_unlock( int );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Signal handling functions */
|
|
Packit |
577717 |
//#undef hwd_siginfo_t
|
|
Packit |
577717 |
//#undef hwd_ucontext_t
|
|
Packit |
577717 |
//typedef int hwd_siginfo_t;
|
|
Packit |
577717 |
//typedef ucontext_t hwd_ucontext_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#endif
|