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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 15 of file perf_event_offcore_response.c.

15 {
16
17 int quiet;
18
19 char *offcore_event=NULL;
20 char event_name[BUFSIZ];
21
22 int retval;
23 int EventSet1 = PAPI_NULL;
24
25 long long total_values[1];
26
27 /* Set TESTS_QUIET variable */
28 quiet = tests_quiet( argc, argv );
29
30 /* Init the PAPI library */
32 if ( retval != PAPI_VER_CURRENT ) {
33 test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
34 }
35
37 if (retval != PAPI_OK) {
38 test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
39 }
40
41 /* Get a relevant event name */
42 offcore_event=get_offcore_event(event_name, BUFSIZ);
43 if (offcore_event==NULL) {
44 if (!quiet) {
45 printf("No test event available on this processor\n");
46 }
47 test_skip( __FILE__, __LINE__,
48 "PAPI does not support offcore on this processor",
50 }
51
52 retval = PAPI_add_named_event(EventSet1, offcore_event);
53 if (retval != PAPI_OK) {
54 if ( !quiet ) {
55 fprintf(stderr,"Error trying to add %s\n",offcore_event);
56 }
57 test_fail(__FILE__, __LINE__, "adding offcore event ",retval);
58 }
59
61 if ( retval != PAPI_OK ) {
62 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
63 }
64
66
67 retval = PAPI_stop( EventSet1, total_values );
68 if ( retval != PAPI_OK ) {
69 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
70 }
71
72 if ( !quiet ) {
73 printf("\t%s count = %lld\n",offcore_event,total_values[0]);
74 }
75
76 test_pass( __FILE__ );
77
78 return 0;
79}
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:29
char * get_offcore_event(char *event, int size)
Definition: event_name_lib.c:7
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
#define PAPI_ENOSUPP
Definition: f90papi.h:244
void do_flops(int n)
Definition: multiplex.c:23
FILE * stderr
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
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 quiet
Definition: rapl_overflow.c:19
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int EventSet1
Definition: zero_fork.c:47
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: