PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

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

Definition at line 16 of file overflow_one_and_read.c.

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

Definition at line 15 of file overflow_one_and_read.c.

Function Documentation

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

Definition at line 32 of file overflow_one_and_read.c.

33 {
34  int retval;
35 
36  ( void ) context;
37 
38  if ( !TESTS_QUIET ) {
39  fprintf( stderr, OVER_FMT, EventSet, address, overflow_vector );
40  }
41 
42  if ( ( retval = PAPI_read( EventSet, dummyvalues ) ) != PAPI_OK )
43  test_fail( __FILE__, __LINE__, "PAPI_read", retval );
44 
45  if ( !TESTS_QUIET ) {
46  fprintf( stderr, TWO12, dummyvalues[0], dummyvalues[1],
47  "(Reading counters)\n" );
48  }
49  if ( dummyvalues[1] == 0 )
50  test_fail( __FILE__, __LINE__, "Total Cycles == 0", 1 );
51 }
#define TWO12
Definition: papi_test.h:117
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define OVER_FMT
int TESTS_QUIET
Definition: test_utils.c:11
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
long long dummyvalues[2]
int PAPI_read(int EventSet, long long *values)
Definition: papi.c:2503
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 54 of file overflow_one_and_read.c.

55 {
56  int EventSet;
57  long long **values = NULL;
58  int retval;
59  int PAPI_event;
61  int num_events1, mask1;
62 
63  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
64 
66  if ( retval != PAPI_VER_CURRENT )
67  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
68 
69  /* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
70  PAPI_TOT_INS, depends on the availability of the event on the
71  platform */
72 /* NOTE: Only adding one overflow on PAPI_event -- no overflow for PAPI_TOT_CYC*/
73  EventSet =
74  add_two_nonderived_events( &num_events1, &PAPI_event, &mask1 );
75 
76  values = allocate_test_space( 2, num_events1 );
77 
78  if ( ( retval =
79  PAPI_event_code_to_name( PAPI_event, event_name ) ) != PAPI_OK )
80  test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
81 
82  retval = PAPI_start( EventSet );
83  if ( retval != PAPI_OK )
84  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
85 
87 
88  retval = PAPI_stop( EventSet, values[0] );
89  if ( retval != PAPI_OK )
90  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
91 
92  retval = PAPI_overflow( EventSet, PAPI_event, THRESHOLD, 0, handler );
93  if ( retval != PAPI_OK )
94  test_fail( __FILE__, __LINE__, "PAPI_overflow", retval );
95 
96  retval = PAPI_start( EventSet );
97  if ( retval != PAPI_OK )
98  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
99 
100  do_flops( NUM_FLOPS );
101 
102  retval = PAPI_stop( EventSet, values[1] );
103  if ( retval != PAPI_OK )
104  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
105 
106  remove_test_events( &EventSet, mask1 );
107 
108 
109  if ( !TESTS_QUIET ) {
110  printf
111  ( "Test case: Overflow dispatch of 1st event in set with 2 events.\n" );
112  printf
113  ( "---------------------------------------------------------------\n" );
114  printf( "Threshold for overflow is: %d\n", THRESHOLD );
115  printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
116  printf( "-----------------------------------------------\n" );
117 
118  printf( "Test type : %16d%16d\n", 1, 2 );
119  printf( OUT_FMT, event_name, ( values[0] )[0], ( values[1] )[0] );
120  printf( OUT_FMT, "PAPI_TOT_CYC", ( values[0] )[1], ( values[1] )[1] );
121  }
122 
123  test_pass( __FILE__, NULL, 0 );
124  exit( 1 );
125 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2258
#define NUM_FLOPS
int mask1
Definition: zero_fork.c:41
int PAPI_event[2]
Definition: data_range.c:24
int num_events1
Definition: zero_fork.c:42
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
int PAPI_overflow(int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler)
Definition: papi.c:4714
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:497
void handler(int EventSet, void *address, long long overflow_vector, void *context)
Definition: rapl_overflow.c:16
int PAPI_event_code_to_name(int EventCode, char *out)
Definition: papi.c:926
#define OUT_FMT
void do_flops(int n)
Definition: multiplex.c:23
#define PAPI_MAX_STR_LEN
Definition: papi.h:463
int add_two_nonderived_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:723
int PAPI_start(int EventSet)
Definition: papi.c:2053
#define THRESHOLD
Definition: earprofile.c:31
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:107
#define PAPI_VER_CURRENT
Definition: papi.h:223
void exit()
int remove_test_events(int *EventSet, int mask)
Definition: test_utils.c:277

Here is the call graph for this function:

Variable Documentation

long long dummyvalues[2]

Definition at line 29 of file overflow_one_and_read.c.

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

Definition at line 26 of file overflow_one_and_read.c.

int total_unknown = 0

Definition at line 27 of file overflow_one_and_read.c.