42 printf(
"Usage: %s [options] [EVENTNAMEs]\n", argv[0] );
43 printf(
"Options:\n\n" );
44 printf(
"General command options:\n" );
45 printf(
"\t-u Display output values as unsigned integers\n" );
46 printf(
"\t-x Display output values as hexadecimal\n" );
47 printf(
"\t-h Print this help message\n" );
48 printf(
"\tEVENTNAMEs Specify one or more preset or native events\n" );
50 printf(
"This utility performs work while measuring the specified events.\n" );
51 printf(
"It can be useful for sanity checks on given events and sets of events.\n" );
56main(
int argc,
char **argv )
68 printf(
"\nThis utility lets you add events from the command line "
69 "interface to see if they work.\n\n" );
73 fprintf(
stderr,
"Error! PAPI_library_init\n");
79 fprintf(
stderr,
"Error! PAPI_create_eventset\n");
84 (
long long * ) malloc(
sizeof (
long long ) * (
size_t ) argc );
85 success = (
char * ) malloc( (
size_t ) argc );
87 if ( success == NULL ||
values == NULL ) {
88 fprintf(
stderr,
"Error allocating memory!\n");
93 if ( !strcmp( argv[
i],
"-h" ) ) {
96 }
else if ( !strcmp( argv[
i],
"-u" ) ) {
98 }
else if ( !strcmp( argv[
i],
"-x" ) ) {
102 printf(
"Failed adding: %s\nbecause: %s\n", argv[
i],
106 printf(
"Successfully added: %s\n", argv[
i] );
115 printf(
"No events specified!\n");
116 printf(
"Try running something like: %s PAPI_TOT_CYC\n\n",
131 fprintf(
stderr,
"Error! PAPI_start\n");
142 fprintf(
stderr,
"Error! PAPI_stop\n");
148 if (! (u_format || hex_format) ) {
157 printf(
"%s : \t%llu(u)", argv[
i], (
unsigned long long)
values[j] );
160 printf(
"%s : \t%0.3f", argv[
i], *((
double *)(&
values[j])) );
163 printf(
"%s : \t%#llX", argv[
i],
values[j] );
167 printf(
"%s : \t%lld", argv[
i],
values[j] );
173 if (u_format) printf(
"%s : \t%llu(u)\n", argv[
i], (
unsigned long long)
values[j] );
174 if (hex_format) printf(
"%s : \t%#llX\n", argv[
i],
values[j] );
177 printf(
"\n----------------------------------\n" );
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
Convert a name to a numeric hardware event code.
Get the event's name and description info.
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
void do_misses(int n, int bytes)
#define L1_MISS_BUFFER_SIZE_INTS
#define PAPI_DATATYPE_FP64
#define PAPI_DATATYPE_UINT64
#define PAPI_DATATYPE_BIT64
#define PAPI_DATATYPE_INT64
static long long values[NUM_EVENTS]
Return codes and api definitions.
static void print_help(void)
int data_type[MAX_EVENTS]
char units[PAPI_MIN_STR_LEN]