47#define COMP_NAME "intel_gpu"
51#define MAX_NUM_METRICS 40
56#define TEST_METRIC "ComputeBasic.GpuTime"
59main(
int argc,
char ** argv) {
69 int listGroupOnly = 0;
70 char *metricName = NULL;
71 char *metricGroupName = NULL;
76 while ((ch=getopt(argc, argv,
"ahm:g:")) != -1) {
80 if (metricGroupName) {
81 printf(
"list all groups, ignore group name\n");
82 metricGroupName = NULL;
86 printf(
"usage: %s [-a] [-g <metricGroupName>] [-m <metricName>]\n", argv[0]);
94 metricGroupName = optarg;
96 printf(
"list all groups, ignore group name\n");
108 fprintf(
stderr,
"PAPI_library_init failed\n" );
113 for (
i=0;
i<numComps;
i++) {
121 printf(
"Component %s is not supported\n", aComp->
name);
125 printf(
"Name: %s\n", aComp->
name);
128 if (selectedAll || listGroupOnly) {
133 memset( &info, 0,
sizeof ( info ) );
137 if (!metricGroupName || !strstr(info.
symbol, metricGroupName)) {
138 char *pt = index(info.
symbol,
'.');
142 if (metricGroupName) {
143 free(metricGroupName);
145 metricGroupName = strdup(info.
symbol);
146 printf(
"%s\n", metricGroupName);
149 }
else if ((!metricGroupName) || strstr(info.
symbol, metricGroupName)) {
158 if (!numMetrics && !numGroups) {
159 fprintf(
stderr,
"Error on enum_cmp_event, abort.\n");
163 printf(
"Total %d metric groups are supported\n", numGroups);
165 printf(
"Total %d metrics are supported\n", numMetrics);
174 printf(
"Query metric by name %s -- ", metricName);
178 printf(
"does not exist, abort.\n");
182 printf(
"is supported.\n");
188 printf(
"PAPI_event_name_to_code event %s dose not exist, abort.\n", metricName);
192 printf(
"Named metric %s is enumerated with code 0x%x.\n", metricName, code);
193 printf(
"Query metric by code 0x%x -- ", code);
196 printf(
"dose not exist, abort.\n");
200 printf(
"is supported.\n");
Enumerate PAPI preset or native events for a given component.
Convert a name to a numeric hardware event code.
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.
Query if PAPI event exists.
Query if a named PAPI event exists.
Finish using PAPI and free all related resources.
long long metric_values[MAX_NUM_METRICS]
Return codes and api definitions.
char description[PAPI_MAX_STR_LEN]
char name[PAPI_MAX_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]