14 {
15
16
17 char *instructions_event=NULL;
19
20 char user_event[BUFSIZ];
21 char kernel_event[BUFSIZ];
22 char user_kernel_event[BUFSIZ];
23
24
26
27
31 int EventSet_default_user_kernel =
PAPI_NULL;
32 long long default_values[1];
33 long long default_user_values[1];
34 long long default_kernel_values[1];
35 long long default_user_kernel_values[1];
36
37
41 int EventSet_user_user_kernel =
PAPI_NULL;
42 long long user_values[1];
43 long long user_user_values[1];
44 long long user_kernel_values[1];
45 long long user_user_kernel_values[1];
46
47
51 int EventSet_kernel_user_kernel =
PAPI_NULL;
52 long long kernel_values[1];
53 long long kernel_user_values[1];
54 long long kernel_kernel_values[1];
55 long long kernel_user_kernel_values[1];
56
57
62 long long all_values[1];
63 long long all_user_values[1];
64 long long all_kernel_values[1];
65 long long all_user_kernel_values[1];
66
67
69 long long two_values[2];
70
72
73
75
76
80 }
81
82
83
85 if (instructions_event==NULL) {
87 "No instructions event definition for this arch",
89 }
90
91 sprintf(user_event,"%s:u=1",instructions_event);
92 sprintf(kernel_event,"%s:k=1",instructions_event);
93 sprintf(user_kernel_event,"%s:u=1:k=1",instructions_event);
94
95
96
97
98
100 printf("\tTwo Events in same EventSet\n");
101 }
102
106 }
107
108
113 }
115 }
119 fprintf(
stderr,
"Error trying to add %s\n",kernel_event);
120 }
122 }
123
127 }
128
130
134 }
135
137 printf("\t\t%s count = %lld, %s count = %lld\n",
138 user_event,two_values[0],
139 kernel_event,two_values[1]);
140 }
141
142
143
144
145
146
148 printf("\tDefault Domain\n");
149 }
150
154 }
155
156
160 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
161 }
163 }
164
168 }
169
171
175 }
176
178 printf("\t\t%s count = %lld\n",instructions_event,default_values[0]);
179 }
180
181
182
183
184
185
189 }
190
191
195 fprintf(
stderr,
"Error trying to add %s\n",user_event);
196 }
198 }
199
203 }
204
206
210 }
211
213 printf("\t\t%s count = %lld\n",user_event,default_user_values[0]);
214 }
215
216
217
218
219
223 }
224
225
229 fprintf(
stderr,
"Error trying to add %s\n",kernel_event);
230 }
232 }
233
237 }
238
240
244 }
245
247 printf("\t\t%s count = %lld\n",kernel_event,default_kernel_values[0]);
248 }
249
250
251
252
253
254
258 }
259
260
264 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
265 }
267 }
268
272 }
273
275
276 retval =
PAPI_stop( EventSet_default_user_kernel, default_user_kernel_values );
279 }
280
282 printf("\t\t%s count = %lld\n",user_kernel_event,default_user_kernel_values[0]);
283 }
284
285
286
287
288
290 printf("\tPAPI_DOM_USER Domain\n");
291 }
292
294
298 }
299
300
304 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
305 }
307 }
308
312 }
313
315
319 }
320
322 printf("\t\t%s count = %lld\n",instructions_event,user_values[0]);
323 }
324
325
326
327
328
329
333 }
334
335
339 fprintf(
stderr,
"Error trying to add %s\n",user_event);
340 }
342 }
343
347 }
348
350
354 }
355
357 printf("\t\t%s count = %lld\n",user_event,user_user_values[0]);
358 }
359
360
361
362
363
367 }
368
369
373 fprintf(
stderr,
"Error trying to add %s\n",user_event);
374 }
376 }
377
381 }
382
384
388 }
389
391 printf("\t\t%s count = %lld\n",kernel_event,user_kernel_values[0]);
392 }
393
394
395
396
397
401 }
402
403
407 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
408 }
410 }
411
415 }
416
418
419 retval =
PAPI_stop( EventSet_user_user_kernel, user_user_kernel_values );
422 }
423
425 printf("\t\t%s count = %lld\n",user_kernel_event,user_user_kernel_values[0]);
426 }
427
428
429
430
431
433 printf("\tPAPI_DOM_KERNEL Domain\n");
434 }
435
437
441 }
442
443
447 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
448 }
450 }
451
455 }
456
458
462 }
463
465 printf("\t\t%s count = %lld\n",instructions_event,kernel_values[0]);
466 }
467
468
469
470
471
472
476 }
477
478
482 fprintf(
stderr,
"Error trying to add %s\n",user_event);
483 }
485 }
486
490 }
491
493
497 }
498
500 printf("\t\t%s count = %lld\n",user_event,kernel_user_values[0]);
501 }
502
503
504
505
506
510 }
511
512
516 fprintf(
stderr,
"Error trying to add %s\n",user_event);
517 }
519 }
520
524 }
525
527
531 }
532
534 printf("\t\t%s count = %lld\n",kernel_event,kernel_kernel_values[0]);
535 }
536
537
538
539
540
544 }
545
546
550 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
551 }
553 }
554
558 }
559
561
562 retval =
PAPI_stop( EventSet_kernel_user_kernel, kernel_user_kernel_values );
565 }
566
568 printf("\t\t%s count = %lld\n",user_kernel_event,kernel_user_kernel_values[0]);
569 }
570
571
572
573
574
576 printf("\tPAPI_DOM_ALL Domain\n");
577 }
578
580
584 }
585
586
590 fprintf(
stderr,
"Error trying to add %s\n",instructions_event);
591 }
593 }
594
598 }
599
601
605 }
606
608 printf("\t\t%s count = %lld\n",instructions_event,all_values[0]);
609 }
610
611
612
613
614
615
619 }
620
621
625 fprintf(
stderr,
"Error trying to add %s\n",user_event);
626 }
628 }
629
633 }
634
636
640 }
641
643 printf("\t\t%s count = %lld\n",user_event,all_user_values[0]);
644 }
645
646
647
648
649
653 }
654
655
659 fprintf(
stderr,
"Error trying to add %s\n",user_event);
660 }
662 }
663
667 }
668
670
674 }
675
677 printf("\t\t%s count = %lld\n",kernel_event,all_kernel_values[0]);
678 }
679
680
681
682
683
687 }
688
689
693 fprintf(
stderr,
"Error trying to add %s\n",user_kernel_event);
694 }
696 }
697
701 }
702
704
705 retval =
PAPI_stop( EventSet_all_user_kernel, all_user_kernel_values );
708 }
709
711 printf("\t\t%s count = %lld\n",user_kernel_event,all_user_kernel_values[0]);
712 }
713
714
715
716
717
718
719
721
722 return 0;
723}
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Set the default counting domain for new event sets bound to the specified component.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
char event_name[2][PAPI_MAX_STR_LEN]
char * get_instructions_event(char *event, int size)
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)