File: linux-bgq.h

package info (click to toggle)
papi 5.7.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,856 kB
  • sloc: ansic: 93,265; fortran: 3,338; xml: 2,460; makefile: 815; sh: 290
file content (137 lines) | stat: -rw-r--r-- 3,549 bytes parent folder | download | duplicates (3)
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
/****************************/
/* THIS IS OPEN SOURCE CODE */
/****************************/

/** 
 * @file    linux-bgq.h
 * CVS:     $Id$
 * @author  Heike Jagode
 *          jagode@eecs.utk.edu
 * Mods:	< your name here >
 *			< your email address >
 * Blue Gene/Q CPU component: BGPM / Punit
 * 
 * Tested version of bgpm (early access)
 *
 * @brief
 *  This file has the source code for a component that enables PAPI-C to 
 *  access hardware monitoring counters for BG/Q through the BGPM library.
 */


#ifndef _LINUX_BGQ_H
#define _LINUX_BGQ_H

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/profil.h>
#include <assert.h>
#include <limits.h>
#include <signal.h>
#include <errno.h>
#include <sys/ucontext.h>
#include <stdarg.h>
#include <ctype.h>
//#include <pthread.h>

#include "linux-bgq-common.h"
/* Header required to obtain BGQ personality */
#include "process_impl.h"
#include "linux-context.h"

/* this number assumes that there will never be more events than indicated */
#define BGQ_PUNIT_MAX_COUNTERS UPC_P_NUM_COUNTERS 
#define BGQ_PUNIT_MAX_EVENTS PEVT_PUNIT_LAST_EVENT
#define MAX_COUNTER_TERMS BGQ_PUNIT_MAX_COUNTERS
// keep a large enough gap between actual BGPM events and our local opcode events
#define OPCODE_BUF ( MAX_COUNTERS + MAX_COUNTERS ) 


#include "papi.h"
#include "papi_preset.h"



typedef struct
{
	int preset;				/* Preset code */
	int derived;				/* Derived code */
	char *( findme[MAX_COUNTER_TERMS] );	/* Strings to look for, more than 1 means derived */
	char *operation;			/* PostFix operations between terms */
	char *note;				/* In case a note is included with a preset */
} bgq_preset_search_entry_t;


// Context structure not used...
typedef struct bgq_context
{
	int reserved;
} bgq_context_t;

typedef struct bgq_overflow
{
  	int threshold;
	int EventIndex;
} bgq_overflow_t;

// Control state structure...  Holds local copy of read counters...
typedef struct bgq_control_state
{
	int EventGroup;
	int EventGroup_local[512];
	int count;
	long_long counters[BGQ_PUNIT_MAX_COUNTERS];
	int muxOn;					// multiplexing on or off flag
	int overflow;				// overflow enable
    int overflow_count;
    bgq_overflow_t overflow_list[512];
	int bgpm_eventset_applied;	// BGPM eventGroup applied yes or no flag
} bgq_control_state_t;

// Register allocation structure
typedef struct bgq_reg_alloc
{
	//_papi_hwd_bgq_native_event_id_t id;
} bgq_reg_alloc_t;

// Register structure not used...
typedef struct bgq_register
{
	/* This is used by the framework.It likes it to be !=0 to do something */
	unsigned int selector;
	/* This is the information needed to locate a BGPM / Punit event */
	unsigned eventID;
} bgq_register_t;

/** This structure is used to build the table of events */
typedef struct bgq_native_event_entry
{
	bgq_register_t resources;
	char name[PAPI_MAX_STR_LEN];
	char description[PAPI_2MAX_STR_LEN];
} bgq_native_event_entry_t;

/* Override void* definitions from PAPI framework layer */
/* with typedefs to conform to PAPI component layer code. */
#undef  hwd_reg_alloc_t
#undef  hwd_register_t
#undef  hwd_control_state_t
#undef  hwd_context_t

typedef bgq_reg_alloc_t hwd_reg_alloc_t;
typedef bgq_register_t hwd_register_t;
typedef bgq_control_state_t hwd_control_state_t;
typedef bgq_context_t hwd_context_t;

extern void _papi_hwd_lock( int );
extern void _papi_hwd_unlock( int );

/* Signal handling functions */
//#undef hwd_siginfo_t
//#undef hwd_ucontext_t
//typedef int hwd_siginfo_t;
//typedef ucontext_t hwd_ucontext_t;

#endif