PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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
7 extern "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 
44 struct test_events_t {
45  unsigned int mask;
46  unsigned int event;
47 };
48 
49 extern struct test_events_t test_events[];
50 
51 void validate_string(const char *name, char *s);
52 void *get_overflow_address(void *context);
53 void free_test_space(long long ** values, int num_tests);
54 long long **allocate_test_space(int num_tests, int num_events);
55 int add_test_events(int *number, int *mask, int allow_derived);
56 int add_two_events(int *num_events, int *papi_event, int *mask);
57 int add_two_nonderived_events(int *num_events, int *papi_event, int *mask);
58 int add_test_events_r(int *number, int *mask, void *handle);
59 int find_nonderived_event( void );
60 int enum_add_native_events(int *num_events, int **evtcodes, int need_interrupts, int no_software_events, int cidx);
61 int remove_test_events(int *EventSet, int mask);
62 
63 char *stringify_domain(int domain);
64 char *stringify_all_domains(int domains);
65 char *stringify_granularity(int granularity);
66 char *stringify_all_granularities(int granularities);
67 int tests_quiet(int argc, char **argv);
68 void test_pass(const char *filename);
69 void test_fail(const char *file, int line, const char *call, int retval);
70 void test_skip(const char *file, int line, const char *call, int retval);
71 void test_warn(const char *file, int line, const char *call, int retval);
72 void test_print_event_header(const char *call, int evset);
73 int approx_equals(double a, double b);
74 
75 /* Unix systems use %lld to display long long values
76  Windows uses %I64d for the same purpose.
77  Since these occur inside a quoted string,
78  we must #define the entire format string.
79  Below are several common forms of this string
80  for both platforms.
81 */
82 
83 #define ONEHDR " %12s"
84 #define TAB2HDR "%s %12s %12s\n"
85 #define TAB3HDR "%s %12s %12s %12s\n"
86 #define TAB4HDR "%s %12s %12s %12s %12s\n"
87 #define ONENUM " %12lld"
88 #define TAB1 "%-12s %12lld\n"
89 #define TAB2 "%-12s %12lld %12lld\n"
90 #define TAB3 "%-12s %12lld %12lld %12lld\n"
91 #define TAB4 "%-12s %12lld %12lld %12lld %12lld\n"
92 #define TAB5 "%-12s %12lld %12lld %12lld %12lld %12lld\n"
93 #define TWO12 "%12lld %12lld %s"
94 #define LLDFMT "%lld"
95 #define LLDFMT10 "%10lld"
96 #define LLDFMT12 "%12lld"
97 #define LLDFMT15 "%15lld"
98 
99 extern int TESTS_QUIET; /* Declared in test_utils.c */
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
void test_pass(const char *filename)
Definition: test_utils.c:432
char * stringify_granularity(int granularity)
Definition: test_utils.c:353
void * get_overflow_address(void *context)
static int num_events
void test_print_event_header(const char *call, int evset)
Definition: test_utils.c:580
char * stringify_all_granularities(int granularities)
Definition: test_utils.c:332
int EventSet
void validate_string(const char *name, char *s)
Definition: test_utils.c:23
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
void test_warn(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:522
int int argc
Definition: iozone.c:1609
void test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:559
char ** argv
Definition: iozone.c:1610
static int cidx
char * stringify_all_domains(int domains)
Definition: test_utils.c:293
FILE * file
Definition: pscanf.h:13
int add_two_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:615
s
Definition: iozone.c:20289
void free_test_space(long long **values, int num_tests)
Definition: test_utils.c:70
int approx_equals(double a, double b)
Definition: test_utils.c:33
int add_test_events_r(int *number, int *mask, void *handle)
nvmlDevice_t handle
Definition: linux-nvml.c:427
int num_tests
Definition: zero_fork.c:53
int enum_add_native_events(int *num_events, int **evtcodes, int need_interrupts, int no_software_events, int cidx)
Definition: test_utils.c:684
struct test_events_t test_events[]
Definition: test_utils.c:130
int TESTS_QUIET
Definition: test_utils.c:18
char * name
Definition: iozone.c:23648
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:468
int add_two_nonderived_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:646
char * stringify_domain(int domain)
Definition: test_utils.c:312
unsigned int event
Definition: papi_test.h:46
int find_nonderived_event(void)
Definition: test_utils.c:98
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
int remove_test_events(int *EventSet, int mask)
Definition: test_utils.c:201
unsigned int mask
Definition: papi_test.h:45
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
int add_test_events(int *number, int *mask, int allow_derived)
Definition: test_utils.c:152