57{
61 char *success;
65 int u_format = 0;
66 int hex_format = 0;
67
68 printf( "\nThis utility lets you add events from the command line "
69 "interface to see if they work.\n\n" );
70
73 fprintf(
stderr,
"Error! PAPI_library_init\n");
75 }
76
79 fprintf(
stderr,
"Error! PAPI_create_eventset\n");
81 }
82
84 (
long long * ) malloc(
sizeof (
long long ) * (
size_t ) argc );
85 success = ( char * ) malloc( ( size_t ) argc );
86
87 if ( success == NULL ||
values == NULL ) {
88 fprintf(
stderr,
"Error allocating memory!\n");
89 exit(1);
90 }
91
93 if ( !strcmp( argv[
i],
"-h" ) ) {
95 exit( 1 );
96 }
else if ( !strcmp( argv[
i],
"-u" ) ) {
97 u_format = 1;
98 }
else if ( !strcmp( argv[
i],
"-x" ) ) {
99 hex_format = 1;
100 } else {
102 printf(
"Failed adding: %s\nbecause: %s\n", argv[
i],
104 } else {
106 printf(
"Successfully added: %s\n", argv[
i] );
107 }
108 }
109 }
110
111
114 free(success);
115 printf("No events specified!\n");
116 printf("Try running something like: %s PAPI_TOT_CYC\n\n",
117 argv[0]);
118 return 0;
119 }
120
121
122 printf( "\n" );
123
126
130 free(success);
131 fprintf(
stderr,
"Error! PAPI_start\n");
133 }
134
137
141 free(success);
142 fprintf(
stderr,
"Error! PAPI_stop\n");
144 }
145
148 if (! (u_format || hex_format) ) {
154 }
157 printf(
"%s : \t%llu(u)", argv[
i], (
unsigned long long)
values[j] );
158 break;
160 printf(
"%s : \t%0.3f", argv[
i], *((
double *)(&
values[j])) );
161 break;
163 printf(
"%s : \t%#llX", argv[
i],
values[j] );
164 break;
166 default:
167 printf(
"%s : \t%lld", argv[
i],
values[j] );
168 break;
169 }
171 printf( "\n" );
172 }
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] );
175 }
176
177 printf( "\n----------------------------------\n" );
178
180 free(success);
181 return 0;
182
183}
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]
static void print_help(void)
int data_type[MAX_EVENTS]
char units[PAPI_MIN_STR_LEN]