53 for ( op = msg; *op !=
'\0'; op++ ) {
56 fprintf(
f,
""" );
59 fprintf(
f,
"&" );
62 fprintf(
f,
"'" );
71 fprintf(
f,
"%c", *op);
89 fprintf(
f,
"<hardware>\n" );
91 fprintf(
f,
" <vendor string=\"");
94 fprintf(
f,
" <vendorCode value=\"%d\"/>\n", hwinfo->
vendor );
95 fprintf(
f,
" <model string=\"");
97 fprintf(
f,
"\"/>\n");
98 fprintf(
f,
" <modelCode value=\"%d\"/>\n", hwinfo->
model );
99 fprintf(
f,
" <cpuRevision value=\"%f\"/>\n", hwinfo->
revision );
100 fprintf(
f,
" <cpuID>\n" );
101 fprintf(
f,
" <family value=\"%d\"/>\n", hwinfo->
cpuid_family );
102 fprintf(
f,
" <model value=\"%d\"/>\n", hwinfo->
cpuid_model );
104 fprintf(
f,
" </cpuID>\n" );
105 fprintf(
f,
" <cpuMaxMegahertz value=\"%d\"/>\n", hwinfo->
cpu_max_mhz );
106 fprintf(
f,
" <cpuMinMegahertz value=\"%d\"/>\n", hwinfo->
cpu_min_mhz );
107 fprintf(
f,
" <threads value=\"%d\"/>\n", hwinfo->
threads );
108 fprintf(
f,
" <cores value=\"%d\"/>\n", hwinfo->
cores );
109 fprintf(
f,
" <sockets value=\"%d\"/>\n", hwinfo->
sockets );
110 fprintf(
f,
" <nodes value=\"%d\"/>\n", hwinfo->
nnodes );
111 fprintf(
f,
" <cpuPerNode value=\"%d\"/>\n", hwinfo->
ncpu );
112 fprintf(
f,
" <totalCPUs value=\"%d\"/>\n", hwinfo->
totalcpus );
113 fprintf(
f,
"</hardware>\n" );
136 fprintf(
stderr,
"Error removing event from eventset\n" );
151 fprintf(
f,
" <event index=\"%d\" name=\"",num);
153 fprintf(
f,
"\" desc=\"");
155 fprintf(
f,
"\">\n");
158 fprintf(
f,
" <modifier name=\"");
160 fprintf(
f,
"\" desc=\"");
162 fprintf(
f,
"\"> </modifier>\n");
180 fprintf(
f,
" <eventset type=\"PRESET\">\n" );
193 fprintf(
f,
" </event>\n" );
197 fprintf(
f,
" </eventset>\n" );
212 fprintf(
f,
" <eventset type=\"NATIVE\">\n" );
242 fprintf(
f,
" </event>\n" );
247 fprintf(
f,
" </event>\n" );
252 fprintf(
f,
" </eventset>\n" );
262 fprintf(
stderr,
"Usage: %s [options] [[event1] event2 ...]\n", argv[0] );
263 fprintf(
stderr,
" options: -h print help message\n" );
264 fprintf(
stderr,
" -p print only preset events\n" );
265 fprintf(
stderr,
" -n print only native events\n" );
266 fprintf(
stderr,
" -c n print only events for component index n\n" );
267 fprintf(
stderr,
"If event1, event2, etc., are specified, then only events\n");
268 fprintf(
stderr,
"that can be run in addition to these events will be printed\n\n");
276 for(
i = 1;
i < argc;
i++ ) {
277 if ( argv[
i][0] ==
'-' ) {
278 switch ( argv[
i][1] ) {
283 cidx = (
i+1) < argc ? atoi( argv[(
i++)+1] ) : -1;
284 if ( cidx < 0 || cidx >= numc ) {
285 fprintf(
stderr,
"Error: component index %d out of bounds (0..%d)\n",
312 "Error: unknown option: %s\n", argv[
i] );
326 fprintf(
stderr,
"Error: unknown event: %s\n", argv[
i] );
334 "Error: event %s cannot be counted with others\n",
355 fprintf(
stderr,
"Error! PAPI_library_init\n");
373 fprintf(
stderr,
"Error! PAPI_create_eventset\n");
384 fprintf(
stdout,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
385 fprintf(
stdout,
"<eventinfo>\n" );
395 fprintf(
stdout,
"<component index=\"%d\" type=\"%s\" id=\"%s\">\n",
403 fprintf(
stdout,
"</component>\n" );
410 fprintf(
stdout,
"<component index=\"%d\" type=\"%s\" id=\"%s\">\n",
418 fprintf(
stdout,
"</component>\n" );
423 fprintf(
stderr,
"Error! PAPI_cleanup_eventset\n");
428 fprintf(
stderr,
"Error! PAPI_destroy_eventset\n");
435 fprintf(
stderr,
"Error! PAPI_create_eventset\n");
443 fprintf(
stdout,
"</eventinfo>\n" );
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 name to a numeric hardware event code.
get information about a specific software component
Get the event's name and description info.
get information about the system hardware
initialize the PAPI library.
Get the number of components available on the system.
Query if PAPI event exists.
removes a hardware event from a PAPI event set.
Set the current debug level for error output from PAPI.
#define PAPI_NTV_ENUM_UMASKS
Return codes and api definitions.
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
static void parse_command_line(int argc, char **argv, int numc)
static int papi_xml_hwinfo(FILE *f)
static int test_event(int evt)
static void enum_preset_events(FILE *f, int cidx)
static int xmlize(const char *msg, FILE *f)
static void xmlize_event(FILE *f, PAPI_event_info_t *info, int num)
static void enum_native_events(FILE *f, int cidx)
char name[PAPI_MAX_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]
char vendor_string[PAPI_MAX_STR_LEN]
char model_string[PAPI_MAX_STR_LEN]