PAPI 7.1.0.0
Loading...
Searching...
No Matches
get_event_component.c File Reference
Include dependency graph for get_event_component.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 17 of file get_event_component.c.

18{
19
20 int i;
21 int retval;
23 int numcmp, cid, our_cid;
24 const PAPI_component_info_t* cmpinfo;
25
26 /* Set TESTS_QUIET variable */
27 tests_quiet( argc, argv );
28
29 /* Init PAPI library */
31 if ( retval != PAPI_VER_CURRENT ) {
32 test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
33 }
34
35 numcmp = PAPI_num_components( );
36
37
38 /* Loop through all components */
39 for( cid = 0; cid < numcmp; cid++ )
40 {
41 cmpinfo = PAPI_get_component_info( cid );
42
43 if (cmpinfo == NULL)
44 {
45 test_fail( __FILE__, __LINE__, "PAPI_get_component_info", 2 );
46 }
47
48 if (cmpinfo->disabled != PAPI_OK && cmpinfo->disabled != PAPI_EDELAY_INIT && !TESTS_QUIET) {
49 printf( "Name: %-23s %s\n", cmpinfo->name ,cmpinfo->description);
50 printf(" \\-> Disabled: %s\n",cmpinfo->disabled_reason);
51 continue;
52 }
53
54
55 i = 0 | PAPI_NATIVE_MASK;
57 if (retval!=PAPI_OK) continue;
58
59 do {
60 if (PAPI_get_event_info( i, &info ) != PAPI_OK) {
61 if (!TESTS_QUIET) {
62 printf("Getting information about event: %#x failed\n", i);
63 }
64 continue;
65 }
67
68 if (our_cid!=cid) {
69 if (!TESTS_QUIET) {
70 printf("%d %d %s\n",cid,our_cid,info.symbol);
71 }
72 test_fail( __FILE__, __LINE__, "component mismatch", 1 );
73 }
74
75 if (!TESTS_QUIET) {
76 printf("%d %d %s\n",cid,our_cid,info.symbol);
77 }
78
79
80 } while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK );
81
82 }
83
84 test_pass( __FILE__ );
85
86 return 0;
87}
int i
Enumerate PAPI preset or native events for a given component.
get information about a specific software component
return component an event belongs to
Get the event's name and description info.
initialize the PAPI library.
Get the number of components available on the system.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_ENUM_EVENTS
Definition: f90papi.h:224
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_ENUM_FIRST
Definition: f90papi.h:85
#define PAPI_EDELAY_INIT
Definition: f90papi.h:271
int TESTS_QUIET
Definition: test_utils.c:18
#define PAPI_NATIVE_MASK
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
char description[PAPI_MAX_STR_LEN]
Definition: papi.h:630
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:627
char disabled_reason[PAPI_HUGE_STR_LEN]
Definition: papi.h:634
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:960
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: