20{
21 (void) argv;
22 (void) argc;
23 int retval,cid,powercap_cid=-1,numcmp;
27 int code;
32 int r,
i,
quiet = 1, passed = 0;
33
36
37 if (2 == argc)
quiet = atoi(argv[1]);
38
39
42 fprintf(
stderr,
"PAPI_library_init failed\n" );
43
44 if (!
quiet) fprintf(
stdout,
"Trying all powercap_ppc events\n" );
45
47
48 for( cid=0; cid<numcmp; cid++ ) {
49
51 fprintf(
stderr,
"PAPI_get_component_info failed\n");
52
53 if ( strstr( cmpinfo->
name,
"powercap_ppc" ) ) {
54 powercap_cid=cid;
55 if ( !
quiet ) fprintf(
stdout,
"Found powercap_ppc component at cid %d\n",powercap_cid );
58 fprintf(
stderr,
"powercap_ppc component disabled: %s\n",
60 }
61 fprintf(
stderr,
"powercap_ppc component disabled\n");
62 }
63 break;
64 }
65 }
66
67
68 if ( cid==numcmp )
69 fprintf(
stderr,
"No powercap_ppc component found\n" );
70
71
73 fprintf(
stderr,
"No counters in the powercap_ppc component\n" );
74
75
78 fprintf(
stderr,
"PAPI_create_eventset()\n");
79
80
86 fprintf(
stdout,
"Error from PAPI_event_code_to_name\n");
87
90 fprintf(
stderr,
"Error getting event info\n");
91
95
97
99 break;
101
103 }
104
105 passed = 1;
107
109 if (!
values) { fprintf(
stderr,
"No enough memory for allocation of values array.\n");
return -1; }
110
114 fprintf(
stdout,
"%-45s%-20s > %lldW\n",
117 passed = 0;
119 passed = 0;
120 }
121
123
125 fprintf(
stdout,
"TEST PASSED\n");
126 else
127 fprintf(
stdout,
"TESTS FAILED\n");
128
129
132 fprintf(
stderr,
"PAPI_cleanup_eventset()\n");
133
136 fprintf(
stderr,
"PAPI_destroy_eventset()\n");
137
138 return 0;
139}
static const char * event_names[2]
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Enumerate PAPI preset or native events for a given component.
Convert a numeric hardware event code to a name.
get information about a specific software component
Get the event's name and description info.
initialize the PAPI library.
Get the number of components available on the system.
Read hardware counters from an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_DATATYPE_INT64
#define PAPI_HUGE_STR_LEN
static long long values[NUM_EVENTS]
int data_type[MAX_EVENTS]
char units[MAX_EVENTS][BUFSIZ]
#define MAX_powercap_EVENTS
Tests basic functionality of powercap component.
char name[PAPI_MAX_STR_LEN]
char disabled_reason[PAPI_HUGE_STR_LEN]
char units[PAPI_MIN_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]