PAPI 7.1.0.0
Loading...
Searching...
No Matches
papi_test.h
Go to the documentation of this file.
1/* Standard headers for PAPI test applications.
2 This file is customized to hide Windows / Unix differences.
3*/
4
5
6#ifdef __cplusplus
7extern "C"
8{
9#endif
10
11
12//#if (!defined(NO_DLFCN) && !defined(_BGL) && !defined(_BGP))
13//#include <dlfcn.h>
14//#endif
15
16//#include <memory.h>
17//#if !defined(__FreeBSD__) && !defined(__APPLE__)
18//#include <malloc.h>
19//#endif
20
21/* Masks to select operations for add_test_events() and remove_test_events()
22 Mask value tells us what events to select.
23*/
24#define MASK_FP_OPS 0x80000
25#define MASK_L1_DCA 0x40000 /* three new events for POWER4 */
26#define MASK_L1_DCW 0x20000
27#define MASK_L1_DCR 0x10000
28#define MASK_TOT_IIS 0x04000 /* Try this if TOT_INS won't work */
29#define MASK_BR_PRC 0x02000
30#define MASK_BR_MSP 0x01000
31#define MASK_BR_CN 0x00800
32#define MASK_L2_TCH 0x00400
33#define MASK_L2_TCA 0x00200
34#define MASK_L2_TCM 0x00100
35#define MASK_L1_DCM 0x00040
36#define MASK_L1_ICM 0x00020
37#define MASK_L1_TCM 0x00010
38#define MASK_FP_INS 0x00004
39#define MASK_TOT_INS 0x00002
40#define MASK_TOT_CYC 0x00001
41
42#define MAX_TEST_EVENTS 18
43
45 unsigned int mask;
46 unsigned int event;
47};
48
49extern struct test_events_t test_events[];
50
51/* Mark non-returning functions if the compiler support GNU C extensions. */
52#if defined(__GNUC__)
53#define PAPI_NORETURN __attribute__ ((__noreturn__))
54#else
55#define PAPI_NORETURN
56#endif
57
58void validate_string(const char *name, char *s);
59void *get_overflow_address(void *context);
60void free_test_space(long long ** values, int num_tests);
61long long **allocate_test_space(int num_tests, int num_events);
62int add_test_events(int *number, int *mask, int allow_derived);
63int add_two_events(int *num_events, int *papi_event, int *mask);
64int add_two_nonderived_events(int *num_events, int *papi_event, int *mask);
65int add_test_events_r(int *number, int *mask, void *handle);
66int find_nonderived_event( void );
67int enum_add_native_events(int *num_events, int **evtcodes, int need_interrupts, int no_software_events, int cidx);
68int remove_test_events(int *EventSet, int mask);
69
70char *stringify_domain(int domain);
71char *stringify_all_domains(int domains);
72char *stringify_granularity(int granularity);
73char *stringify_all_granularities(int granularities);
74int tests_quiet(int argc, char **argv);
75void PAPI_NORETURN test_pass(const char *filename);
76void PAPI_NORETURN test_hl_pass(const char *filename);
77void PAPI_NORETURN test_fail(const char *file, int line,
78 const char *call, int retval);
79void PAPI_NORETURN test_skip(const char *file, int line,
80 const char *call, int retval);
81void test_warn(const char *file, int line, const char *call, int retval);
82void test_print_event_header(const char *call, int evset);
83int approx_equals(double a, double b);
84
85/* Unix systems use %lld to display long long values
86 Windows uses %I64d for the same purpose.
87 Since these occur inside a quoted string,
88 we must #define the entire format string.
89 Below are several common forms of this string
90 for both platforms.
91*/
92
93#define ONEHDR " %12s"
94#define TAB2HDR "%s %12s %12s\n"
95#define TAB3HDR "%s %12s %12s %12s\n"
96#define TAB4HDR "%s %12s %12s %12s %12s\n"
97#define ONENUM " %12lld"
98#define TAB1 "%-12s %12lld\n"
99#define TAB2 "%-12s %12lld %12lld\n"
100#define TAB3 "%-12s %12lld %12lld %12lld\n"
101#define TAB4 "%-12s %12lld %12lld %12lld %12lld\n"
102#define TAB5 "%-12s %12lld %12lld %12lld %12lld %12lld\n"
103#define TWO12 "%12lld %12lld %s"
104#define LLDFMT "%lld"
105#define LLDFMT10 "%10lld"
106#define LLDFMT12 "%12lld"
107#define LLDFMT15 "%15lld"
108
109extern int TESTS_QUIET; /* Declared in test_utils.c */
110
111#ifdef __cplusplus
112}
113#endif
114
static papi_handle_t handle
Definition: Gamum.c:21
double s
Definition: byte_profile.c:36
static int EventSet
Definition: init_fini.c:8
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
static int num_events
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
int add_test_events(int *number, int *mask, int allow_derived)
Definition: test_utils.c:152
void validate_string(const char *name, char *s)
Definition: test_utils.c:23
char * stringify_all_domains(int domains)
Definition: test_utils.c:293
void PAPI_NORETURN test_hl_pass(const char *filename)
Definition: test_utils.c:467
char * stringify_domain(int domain)
Definition: test_utils.c:312
int add_two_nonderived_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:671
struct test_events_t test_events[]
Definition: test_utils.c:130
void free_test_space(long long **values, int num_tests)
Definition: test_utils.c:70
int add_test_events_r(int *number, int *mask, void *handle)
int TESTS_QUIET
Definition: test_utils.c:18
char * stringify_granularity(int granularity)
Definition: test_utils.c:353
void test_print_event_header(const char *call, int evset)
Definition: test_utils.c:605
int enum_add_native_events(int *num_events, int **evtcodes, int need_interrupts, int no_software_events, int cidx)
Definition: test_utils.c:709
int approx_equals(double a, double b)
Definition: test_utils.c:33
#define PAPI_NORETURN
Definition: papi_test.h:55
char * stringify_all_granularities(int granularities)
Definition: test_utils.c:332
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
void PAPI_NORETURN test_pass(const char *filename)
Definition: test_utils.c:432
int find_nonderived_event(void)
Definition: test_utils.c:98
int add_two_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:640
void * get_overflow_address(void *context)
void test_warn(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:547
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:584
int remove_test_events(int *EventSet, int mask)
Definition: test_utils.c:201
static int cidx
const char FILE * file
Definition: pscanf.h:13
const char * name
Definition: rocs.c:225
unsigned int mask
Definition: papi_test.h:45
unsigned int event
Definition: papi_test.h:46
int num_tests
Definition: zero_fork.c:53
int retval
Definition: zero_fork.c:53