PAPI 7.1.0.0
Loading...
Searching...
No Matches
overflow_one_and_read.c File Reference
Include dependency graph for overflow_one_and_read.c:

Go to the source code of this file.

Data Structures

struct  ocount_t
 

Macros

#define OVER_FMT   "handler(%d) Overflow at %p! vector=%#llx\n"
 
#define OUT_FMT   "%-12s : %16lld%16lld\n"
 

Functions

void handler (int EventSet, void *address, long long overflow_vector, void *context)
 
int main (int argc, char **argv)
 

Variables

ocount_t overflow_counts [3] = { {0, 0}, {0, 0}, {0, 0} }
 
int total_unknown = 0
 
long long dummyvalues [2]
 

Macro Definition Documentation

◆ OUT_FMT

#define OUT_FMT   "%-12s : %16lld%16lld\n"

Definition at line 22 of file overflow_one_and_read.c.

◆ OVER_FMT

#define OVER_FMT   "handler(%d) Overflow at %p! vector=%#llx\n"

Definition at line 21 of file overflow_one_and_read.c.

Function Documentation

◆ handler()

void handler ( int  EventSet,
void *  address,
long long  overflow_vector,
void *  context 
)

Definition at line 38 of file overflow_one_and_read.c.

39{
40 int retval;
41
42 ( void ) context;
43
44 if ( !TESTS_QUIET ) {
45 fprintf( stderr, OVER_FMT, EventSet, address, overflow_vector );
46 }
47
48 if ( ( retval = PAPI_read( EventSet, dummyvalues ) ) != PAPI_OK )
49 test_fail( __FILE__, __LINE__, "PAPI_read", retval );
50
51 if ( !TESTS_QUIET ) {
52 fprintf( stderr, TWO12, dummyvalues[0], dummyvalues[1],
53 "(Reading counters)\n" );
54 }
55 if ( dummyvalues[1] == 0 )
56 test_fail( __FILE__, __LINE__, "Total Cycles == 0", 1 );
57}
Read hardware counters from an event set.
#define PAPI_OK
Definition: f90papi.h:73
static int EventSet
Definition: init_fini.c:8
int TESTS_QUIET
Definition: test_utils.c:18
#define OVER_FMT
long long dummyvalues[2]
FILE * stderr
#define TWO12
Definition: papi_test.h:103
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 60 of file overflow_one_and_read.c.

61{
62 int EventSet;
63 long long **values = NULL;
64 int retval;
65 int PAPI_event;
67 int num_events1, mask1;
68 int quiet;
69
70 /* Set TESTS_QUIET variable */
71 quiet=tests_quiet( argc, argv );
72
74 if ( retval != PAPI_VER_CURRENT ) {
75 test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
76 }
77
78 /* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
79 PAPI_TOT_INS, depends on the availability of the event on the
80 platform */
81/* NOTE: Only adding one overflow on PAPI_event -- no overflow for PAPI_TOT_CYC*/
83 &PAPI_event, &mask1 );
84 if (num_events1==0) {
85 if (!quiet) printf("Trouble adding events\n");
86 test_skip(__FILE__,__LINE__,"Adding event",1);
87 }
88
90
91 if ( ( retval =
93 test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
94
96 if ( retval != PAPI_OK )
97 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
98
100
102 if ( retval != PAPI_OK )
103 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
104
106 if ( retval != PAPI_OK )
107 test_fail( __FILE__, __LINE__, "PAPI_overflow", retval );
108
110 if ( retval != PAPI_OK )
111 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
112
114
116 if ( retval != PAPI_OK )
117 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
118
120
121
122 if ( !TESTS_QUIET ) {
123 printf
124 ( "Test case: Overflow dispatch of 1st event in set with 2 events.\n" );
125 printf
126 ( "---------------------------------------------------------------\n" );
127 printf( "Threshold for overflow is: %d\n", THRESHOLD );
128 printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
129 printf( "-----------------------------------------------\n" );
130
131 printf( "Test type : %16d%16d\n", 1, 2 );
132 printf( OUT_FMT, event_name, ( values[0] )[0], ( values[1] )[0] );
133 printf( OUT_FMT, "PAPI_TOT_CYC", ( values[0] )[1], ( values[1] )[1] );
134 }
135
136 test_pass( __FILE__ );
137
138 return 0;
139}
Convert a numeric hardware event code to a name.
initialize the PAPI library.
Set up an event set to begin registering overflows.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
int PAPI_event[2]
Definition: data_range.c:30
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:29
#define THRESHOLD
Definition: earprofile.c:37
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
void do_flops(int n)
Definition: multiplex.c:23
void handler(int EventSet, void *address, long long overflow_vector, void *context)
#define OUT_FMT
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
int add_two_nonderived_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:671
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
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
int quiet
Definition: rapl_overflow.c:19
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int num_events1
Definition: zero_fork.c:49
int mask1
Definition: zero_fork.c:48
Here is the call graph for this function:

Variable Documentation

◆ dummyvalues

long long dummyvalues[2]

Definition at line 35 of file overflow_one_and_read.c.

◆ overflow_counts

ocount_t overflow_counts[3] = { {0, 0}, {0, 0}, {0, 0} }

Definition at line 32 of file overflow_one_and_read.c.

◆ total_unknown

int total_unknown = 0

Definition at line 33 of file overflow_one_and_read.c.