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