18 {
19
24 char uncore_base[BUFSIZ];
25 char uncore_event[BUFSIZ];
26 int uncore_cidx=-1;
27 int max_cbox=0;
28 int core_to_use=0;
30
32
33
35
36
40 }
41
42
44 if (uncore_cidx<0) {
46 printf("perf_event_uncore component not found\n");
47 }
48 test_skip(__FILE__,__LINE__,
"perf_event_uncore component not found",0);
49 }
50
51
53 if ( hwinfo == NULL ) {
55 }
56
57
60
63 printf("No event available\n");
64 }
67 }
68 }
69 else {
71 printf("We only support Intel for now\n");
72 }
75 }
76
78 printf(
"Trying for %d sockets\n",hwinfo->
sockets);
79 printf(
"threads %d cores %d ncpus %d\n", hwinfo->
threads,hwinfo->
cores,
81 }
82
84
85
86
89 printf(
"Using core %d for socket %d\n",core_to_use,
i);
90 }
91
93
94
99 }
100
101
104 test_fail(__FILE__, __LINE__,
"PAPI_assign_eventset_component",
retval);
105 }
106
107
108
110
113
117 printf("Problem with PAPI_CPU_ATTACH\n");
118 }
120 "this test; trying to PAPI_CPU_ATTACH; need to run as root",
122 }
123
124
125
126
127
128
129 retval = snprintf(uncore_event, BUFSIZ,
"%s%d::%s",uncore_base,j,
event_name);
131 fprintf(
stderr,
"Event full name \"%s%d::%s\" has been truncated to \"%s\"\n",uncore_base,j,
event_name, uncore_event);
132 }
135 max_cbox=j;
136 break;
137 }
139 printf(
"Added %s for socket %d\n",uncore_event,
i);
140 }
141
142 }
143 }
144
146
147 for(j=0;j<max_cbox;j++) {
149 printf(
"Starting EventSet %d\n",
EventSet[j][
i]);
150 }
151
152
155 printf(
"Error starting socket %d cbox %d\n",
i,j);
157 }
158 }
159 }
160
161
163
164
166 for(j=0;j<max_cbox;j++) {
170 printf(
"Error stopping socket %d cbox %d\n",
i,j);
171 }
173 }
174 }
175 }
176
177
180 printf(
"Socket %d\n",
i);
181 for(j=0;j<max_cbox;j++) {
183 }
184 }
185 }
186
188
190
191 return 0;
192}
add PAPI preset or native hardware event by name to an EventSet
Assign a component index to an existing but empty EventSet.
Create a new empty PAPI EventSet.
returns the component index for the named component
get information about the system hardware
initialize the PAPI library.
Set PAPI library or event set options.
Finish using PAPI and free all related resources.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
char event_name[2][PAPI_MAX_STR_LEN]
#define PAPI_VENDOR_INTEL
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char * get_uncore_cbox_event(char *event_name, char *uncore_base, int size)
A pointer to the following is passed to PAPI_set/get_opt()