PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
perf_event_user_kernel.c
Go to the documentation of this file.
1 /*
2  * This tests the use of offcore_response events
3  */
4 
5 #include <stdio.h>
6 
7 #include "papi.h"
8 #include "papi_test.h"
9 
10 #include "do_loops.h"
11 
12 #include "event_name_lib.h"
13 
14 int main( int argc, char **argv ) {
15 
16 
17  char *instructions_event=NULL;
18  char event_name[BUFSIZ];
19 
20  char user_event[BUFSIZ];
21  char kernel_event[BUFSIZ];
22  char user_kernel_event[BUFSIZ];
23 
24 
25  int retval;
26 
27  /* Default Domain */
28  int EventSet_default = PAPI_NULL;
29  int EventSet_default_user = PAPI_NULL;
30  int EventSet_default_kernel = PAPI_NULL;
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  /* User Domain */
38  int EventSet_user = PAPI_NULL;
39  int EventSet_user_user = PAPI_NULL;
40  int EventSet_user_kernel = PAPI_NULL;
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  /* Kernel Domain */
48  int EventSet_kernel = PAPI_NULL;
49  int EventSet_kernel_user = PAPI_NULL;
50  int EventSet_kernel_kernel = PAPI_NULL;
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  /* All Domain */
58  int EventSet_all = PAPI_NULL;
59  int EventSet_all_user = PAPI_NULL;
60  int EventSet_all_kernel = PAPI_NULL;
61  int EventSet_all_user_kernel = PAPI_NULL;
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  /* Two Events */
68  int EventSet_two = PAPI_NULL;
69  long long two_values[2];
70 
71  int quiet=0;
72 
73  /* Set TESTS_QUIET variable */
74  quiet=tests_quiet( argc, argv );
75 
76  /* Init the PAPI library */
78  if ( retval != PAPI_VER_CURRENT ) {
79  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
80  }
81 
82 
83  /* Get a relevant event name */
84  instructions_event=get_instructions_event(event_name, BUFSIZ);
85  if (instructions_event==NULL) {
86  test_skip( __FILE__, __LINE__,
87  "No instructions event definition for this arch",
88  PAPI_ENOSUPP );
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  /* Two Events */
97  /*********************************/
98 
99  if (!quiet) {
100  printf("\tTwo Events in same EventSet\n");
101  }
102 
103  retval = PAPI_create_eventset(&EventSet_two);
104  if (retval != PAPI_OK) {
105  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
106  }
107 
108 
109  retval = PAPI_add_named_event(EventSet_two, user_event);
110  if (retval != PAPI_OK) {
111  if ( !quiet ) {
112  fprintf(stderr,"Error trying to add %s %s\n",user_event,PAPI_strerror(retval));
113  }
114  test_skip( __FILE__, __LINE__,"Could not add event",PAPI_ENOSUPP);
115  }
116  retval = PAPI_add_named_event(EventSet_two, kernel_event);
117  if (retval != PAPI_OK) {
118  if ( !quiet ) {
119  fprintf(stderr,"Error trying to add %s\n",kernel_event);
120  }
121  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
122  }
123 
124  retval = PAPI_start( EventSet_two );
125  if ( retval != PAPI_OK ) {
126  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
127  }
128 
129  do_flops( NUM_FLOPS );
130 
131  retval = PAPI_stop( EventSet_two, two_values );
132  if ( retval != PAPI_OK ) {
133  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
134  }
135 
136  if ( !quiet ) {
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  /* Default Domain, Default Event */
145  /*********************************/
146 
147  if (!quiet) {
148  printf("\tDefault Domain\n");
149  }
150 
151  retval = PAPI_create_eventset(&EventSet_default);
152  if (retval != PAPI_OK) {
153  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
154  }
155 
156 
157  retval = PAPI_add_named_event(EventSet_default, instructions_event);
158  if (retval != PAPI_OK) {
159  if ( !quiet ) {
160  fprintf(stderr,"Error trying to add %s\n",instructions_event);
161  }
162  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
163  }
164 
165  retval = PAPI_start( EventSet_default );
166  if ( retval != PAPI_OK ) {
167  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
168  }
169 
170  do_flops( NUM_FLOPS );
171 
172  retval = PAPI_stop( EventSet_default, default_values );
173  if ( retval != PAPI_OK ) {
174  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
175  }
176 
177  if ( !quiet ) {
178  printf("\t\t%s count = %lld\n",instructions_event,default_values[0]);
179  }
180 
181 
182  /*********************************/
183  /* Default Domain, User Event */
184  /*********************************/
185 
186  retval = PAPI_create_eventset(&EventSet_default_user);
187  if (retval != PAPI_OK) {
188  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
189  }
190 
191 
192  retval = PAPI_add_named_event(EventSet_default_user, user_event);
193  if (retval != PAPI_OK) {
194  if ( !quiet ) {
195  fprintf(stderr,"Error trying to add %s\n",user_event);
196  }
197  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
198  }
199 
200  retval = PAPI_start( EventSet_default_user );
201  if ( retval != PAPI_OK ) {
202  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
203  }
204 
205  do_flops( NUM_FLOPS );
206 
207  retval = PAPI_stop( EventSet_default_user, default_user_values );
208  if ( retval != PAPI_OK ) {
209  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
210  }
211 
212  if ( !quiet ) {
213  printf("\t\t%s count = %lld\n",user_event,default_user_values[0]);
214  }
215 
216  /*********************************/
217  /* Default Domain, Kernel Event */
218  /*********************************/
219 
220  retval = PAPI_create_eventset(&EventSet_default_kernel);
221  if (retval != PAPI_OK) {
222  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
223  }
224 
225 
226  retval = PAPI_add_named_event(EventSet_default_kernel, kernel_event);
227  if (retval != PAPI_OK) {
228  if ( !quiet ) {
229  fprintf(stderr,"Error trying to add %s\n",kernel_event);
230  }
231  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
232  }
233 
234  retval = PAPI_start( EventSet_default_kernel );
235  if ( retval != PAPI_OK ) {
236  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
237  }
238 
239  do_flops( NUM_FLOPS );
240 
241  retval = PAPI_stop( EventSet_default_kernel, default_kernel_values );
242  if ( retval != PAPI_OK ) {
243  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
244  }
245 
246  if ( !quiet ) {
247  printf("\t\t%s count = %lld\n",kernel_event,default_kernel_values[0]);
248  }
249 
250  /*****************************************/
251  /* Default Domain, user and Kernel Event */
252  /*****************************************/
253 
254 
255  retval = PAPI_create_eventset(&EventSet_default_user_kernel);
256  if (retval != PAPI_OK) {
257  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
258  }
259 
260 
261  retval = PAPI_add_named_event(EventSet_default_user_kernel, user_kernel_event);
262  if (retval != PAPI_OK) {
263  if ( !quiet ) {
264  fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
265  }
266  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
267  }
268 
269  retval = PAPI_start( EventSet_default_user_kernel );
270  if ( retval != PAPI_OK ) {
271  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
272  }
273 
274  do_flops( NUM_FLOPS );
275 
276  retval = PAPI_stop( EventSet_default_user_kernel, default_user_kernel_values );
277  if ( retval != PAPI_OK ) {
278  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
279  }
280 
281  if ( !quiet ) {
282  printf("\t\t%s count = %lld\n",user_kernel_event,default_user_kernel_values[0]);
283  }
284 
285  /*********************************/
286  /* User Domain, Default Event */
287  /*********************************/
288 
289  if (!quiet) {
290  printf("\tPAPI_DOM_USER Domain\n");
291  }
292 
294 
295  retval = PAPI_create_eventset(&EventSet_user);
296  if (retval != PAPI_OK) {
297  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
298  }
299 
300 
301  retval = PAPI_add_named_event(EventSet_user, instructions_event);
302  if (retval != PAPI_OK) {
303  if ( !quiet ) {
304  fprintf(stderr,"Error trying to add %s\n",instructions_event);
305  }
306  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
307  }
308 
309  retval = PAPI_start( EventSet_user );
310  if ( retval != PAPI_OK ) {
311  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
312  }
313 
314  do_flops( NUM_FLOPS );
315 
316  retval = PAPI_stop( EventSet_user, user_values );
317  if ( retval != PAPI_OK ) {
318  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
319  }
320 
321  if ( !quiet ) {
322  printf("\t\t%s count = %lld\n",instructions_event,user_values[0]);
323  }
324 
325 
326  /*********************************/
327  /* User Domain, User Event */
328  /*********************************/
329 
330  retval = PAPI_create_eventset(&EventSet_user_user);
331  if (retval != PAPI_OK) {
332  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
333  }
334 
335 
336  retval = PAPI_add_named_event(EventSet_user_user, user_event);
337  if (retval != PAPI_OK) {
338  if ( !quiet ) {
339  fprintf(stderr,"Error trying to add %s\n",user_event);
340  }
341  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
342  }
343 
344  retval = PAPI_start( EventSet_user_user );
345  if ( retval != PAPI_OK ) {
346  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
347  }
348 
349  do_flops( NUM_FLOPS );
350 
351  retval = PAPI_stop( EventSet_user_user, user_user_values );
352  if ( retval != PAPI_OK ) {
353  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
354  }
355 
356  if ( !quiet ) {
357  printf("\t\t%s count = %lld\n",user_event,user_user_values[0]);
358  }
359 
360  /*********************************/
361  /* User Domain, Kernel Event */
362  /*********************************/
363 
364  retval = PAPI_create_eventset(&EventSet_user_kernel);
365  if (retval != PAPI_OK) {
366  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
367  }
368 
369 
370  retval = PAPI_add_named_event(EventSet_user_kernel, kernel_event);
371  if (retval != PAPI_OK) {
372  if ( !quiet ) {
373  fprintf(stderr,"Error trying to add %s\n",user_event);
374  }
375  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
376  }
377 
378  retval = PAPI_start( EventSet_user_kernel );
379  if ( retval != PAPI_OK ) {
380  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
381  }
382 
383  do_flops( NUM_FLOPS );
384 
385  retval = PAPI_stop( EventSet_user_kernel, user_kernel_values );
386  if ( retval != PAPI_OK ) {
387  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
388  }
389 
390  if ( !quiet ) {
391  printf("\t\t%s count = %lld\n",kernel_event,user_kernel_values[0]);
392  }
393 
394  /*****************************************/
395  /* User Domain, user and Kernel Event */
396  /*****************************************/
397 
398  retval = PAPI_create_eventset(&EventSet_user_user_kernel);
399  if (retval != PAPI_OK) {
400  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
401  }
402 
403 
404  retval = PAPI_add_named_event(EventSet_user_user_kernel, user_kernel_event);
405  if (retval != PAPI_OK) {
406  if ( !quiet ) {
407  fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
408  }
409  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
410  }
411 
412  retval = PAPI_start( EventSet_user_user_kernel );
413  if ( retval != PAPI_OK ) {
414  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
415  }
416 
417  do_flops( NUM_FLOPS );
418 
419  retval = PAPI_stop( EventSet_user_user_kernel, user_user_kernel_values );
420  if ( retval != PAPI_OK ) {
421  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
422  }
423 
424  if ( !quiet ) {
425  printf("\t\t%s count = %lld\n",user_kernel_event,user_user_kernel_values[0]);
426  }
427 
428  /*********************************/
429  /* Kernel Domain, Default Event */
430  /*********************************/
431 
432  if (!quiet) {
433  printf("\tPAPI_DOM_KERNEL Domain\n");
434  }
435 
437 
438  retval = PAPI_create_eventset(&EventSet_kernel);
439  if (retval != PAPI_OK) {
440  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
441  }
442 
443 
444  retval = PAPI_add_named_event(EventSet_kernel, instructions_event);
445  if (retval != PAPI_OK) {
446  if ( !quiet ) {
447  fprintf(stderr,"Error trying to add %s\n",instructions_event);
448  }
449  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
450  }
451 
452  retval = PAPI_start( EventSet_kernel );
453  if ( retval != PAPI_OK ) {
454  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
455  }
456 
457  do_flops( NUM_FLOPS );
458 
459  retval = PAPI_stop( EventSet_kernel, kernel_values );
460  if ( retval != PAPI_OK ) {
461  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
462  }
463 
464  if ( !quiet ) {
465  printf("\t\t%s count = %lld\n",instructions_event,kernel_values[0]);
466  }
467 
468 
469  /*********************************/
470  /* Kernel Domain, User Event */
471  /*********************************/
472 
473  retval = PAPI_create_eventset(&EventSet_kernel_user);
474  if (retval != PAPI_OK) {
475  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
476  }
477 
478 
479  retval = PAPI_add_named_event(EventSet_kernel_user, user_event);
480  if (retval != PAPI_OK) {
481  if ( !quiet ) {
482  fprintf(stderr,"Error trying to add %s\n",user_event);
483  }
484  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
485  }
486 
487  retval = PAPI_start( EventSet_kernel_user );
488  if ( retval != PAPI_OK ) {
489  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
490  }
491 
492  do_flops( NUM_FLOPS );
493 
494  retval = PAPI_stop( EventSet_kernel_user, kernel_user_values );
495  if ( retval != PAPI_OK ) {
496  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
497  }
498 
499  if ( !quiet ) {
500  printf("\t\t%s count = %lld\n",user_event,kernel_user_values[0]);
501  }
502 
503  /*********************************/
504  /* Kernel Domain, Kernel Event */
505  /*********************************/
506 
507  retval = PAPI_create_eventset(&EventSet_kernel_kernel);
508  if (retval != PAPI_OK) {
509  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
510  }
511 
512 
513  retval = PAPI_add_named_event(EventSet_kernel_kernel, kernel_event);
514  if (retval != PAPI_OK) {
515  if ( !quiet ) {
516  fprintf(stderr,"Error trying to add %s\n",user_event);
517  }
518  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
519  }
520 
521  retval = PAPI_start( EventSet_kernel_kernel );
522  if ( retval != PAPI_OK ) {
523  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
524  }
525 
526  do_flops( NUM_FLOPS );
527 
528  retval = PAPI_stop( EventSet_kernel_kernel, kernel_kernel_values );
529  if ( retval != PAPI_OK ) {
530  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
531  }
532 
533  if ( !quiet ) {
534  printf("\t\t%s count = %lld\n",kernel_event,kernel_kernel_values[0]);
535  }
536 
537  /*****************************************/
538  /* Kernel Domain, user and Kernel Event */
539  /*****************************************/
540 
541  retval = PAPI_create_eventset(&EventSet_kernel_user_kernel);
542  if (retval != PAPI_OK) {
543  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
544  }
545 
546 
547  retval = PAPI_add_named_event(EventSet_kernel_user_kernel, user_kernel_event);
548  if (retval != PAPI_OK) {
549  if ( !quiet ) {
550  fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
551  }
552  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
553  }
554 
555  retval = PAPI_start( EventSet_kernel_user_kernel );
556  if ( retval != PAPI_OK ) {
557  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
558  }
559 
560  do_flops( NUM_FLOPS );
561 
562  retval = PAPI_stop( EventSet_kernel_user_kernel, kernel_user_kernel_values );
563  if ( retval != PAPI_OK ) {
564  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
565  }
566 
567  if ( !quiet ) {
568  printf("\t\t%s count = %lld\n",user_kernel_event,kernel_user_kernel_values[0]);
569  }
570 
571  /*********************************/
572  /* All Domain, Default Event */
573  /*********************************/
574 
575  if (!quiet) {
576  printf("\tPAPI_DOM_ALL Domain\n");
577  }
578 
580 
581  retval = PAPI_create_eventset(&EventSet_all);
582  if (retval != PAPI_OK) {
583  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
584  }
585 
586 
587  retval = PAPI_add_named_event(EventSet_all, instructions_event);
588  if (retval != PAPI_OK) {
589  if ( !quiet ) {
590  fprintf(stderr,"Error trying to add %s\n",instructions_event);
591  }
592  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
593  }
594 
595  retval = PAPI_start( EventSet_all );
596  if ( retval != PAPI_OK ) {
597  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
598  }
599 
600  do_flops( NUM_FLOPS );
601 
602  retval = PAPI_stop( EventSet_all, all_values );
603  if ( retval != PAPI_OK ) {
604  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
605  }
606 
607  if ( !quiet ) {
608  printf("\t\t%s count = %lld\n",instructions_event,all_values[0]);
609  }
610 
611 
612  /*********************************/
613  /* All Domain, User Event */
614  /*********************************/
615 
616  retval = PAPI_create_eventset(&EventSet_all_user);
617  if (retval != PAPI_OK) {
618  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
619  }
620 
621 
622  retval = PAPI_add_named_event(EventSet_all_user, user_event);
623  if (retval != PAPI_OK) {
624  if ( !quiet ) {
625  fprintf(stderr,"Error trying to add %s\n",user_event);
626  }
627  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
628  }
629 
630  retval = PAPI_start( EventSet_all_user );
631  if ( retval != PAPI_OK ) {
632  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
633  }
634 
635  do_flops( NUM_FLOPS );
636 
637  retval = PAPI_stop( EventSet_all_user, all_user_values );
638  if ( retval != PAPI_OK ) {
639  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
640  }
641 
642  if ( !quiet ) {
643  printf("\t\t%s count = %lld\n",user_event,all_user_values[0]);
644  }
645 
646  /*********************************/
647  /* All Domain, Kernel Event */
648  /*********************************/
649 
650  retval = PAPI_create_eventset(&EventSet_all_kernel);
651  if (retval != PAPI_OK) {
652  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
653  }
654 
655 
656  retval = PAPI_add_named_event(EventSet_all_kernel, kernel_event);
657  if (retval != PAPI_OK) {
658  if ( !quiet ) {
659  fprintf(stderr,"Error trying to add %s\n",user_event);
660  }
661  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
662  }
663 
664  retval = PAPI_start( EventSet_all_kernel );
665  if ( retval != PAPI_OK ) {
666  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
667  }
668 
669  do_flops( NUM_FLOPS );
670 
671  retval = PAPI_stop( EventSet_all_kernel, all_kernel_values );
672  if ( retval != PAPI_OK ) {
673  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
674  }
675 
676  if ( !quiet ) {
677  printf("\t\t%s count = %lld\n",kernel_event,all_kernel_values[0]);
678  }
679 
680  /*****************************************/
681  /* All Domain, user and Kernel Event */
682  /*****************************************/
683 
684  retval = PAPI_create_eventset(&EventSet_all_user_kernel);
685  if (retval != PAPI_OK) {
686  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
687  }
688 
689 
690  retval = PAPI_add_named_event(EventSet_all_user_kernel, user_kernel_event);
691  if (retval != PAPI_OK) {
692  if ( !quiet ) {
693  fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
694  }
695  test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
696  }
697 
698  retval = PAPI_start( EventSet_all_user_kernel );
699  if ( retval != PAPI_OK ) {
700  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
701  }
702 
703  do_flops( NUM_FLOPS );
704 
705  retval = PAPI_stop( EventSet_all_user_kernel, all_user_kernel_values );
706  if ( retval != PAPI_OK ) {
707  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
708  }
709 
710  if ( !quiet ) {
711  printf("\t\t%s count = %lld\n",user_kernel_event,all_user_kernel_values[0]);
712  }
713 
714  /**************/
715  /* Validation */
716  /**************/
717 
718  //TODO
719 
720  test_pass( __FILE__ );
721 
722  return 0;
723 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:29
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
void test_pass(const char *filename)
Definition: test_utils.c:432
#define PAPI_ENOSUPP
Definition: papi.h:271
#define PAPI_NULL
Definition: papi.h:292
#define PAPI_DOM_KERNEL
Definition: papi.h:300
#define PAPI_DOM_ALL
Definition: papi.h:303
return PAPI_OK
Definition: linux-nvml.c:497
#define PAPI_DOM_USER
Definition: papi.h:298
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int int argc
Definition: iozone.c:1609
Return codes and api definitions.
void test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:559
int PAPI_add_named_event(int EventSet, const char *EventName)
Definition: papi.c:1876
int PAPI_set_cmp_domain(int domain, int cidx)
Definition: papi.c:5758
char ** argv
Definition: iozone.c:1610
int PAPI_library_init(int version)
Definition: papi.c:500
int quiet
Definition: rapl_overflow.c:18
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1464
void do_flops(int n)
Definition: multiplex.c:23
printf("\tTry: -i 0 -i 1 \n\n")
char * PAPI_strerror(int errorCode)
Definition: papi.c:4603
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:468
char * get_instructions_event(char *event, int size)
int PAPI_start(int EventSet)
Definition: papi.c:2096
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:225
int main(int argc, char **argv)
List all appio events codes and names.