PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
perf_event_system_wide.c
Go to the documentation of this file.
1 /*
2  * This tests the measuring of events using a system-wide granularity
3  */
4 
5 #include "papi_test.h"
6 
7 #ifndef __USE_GNU
8 #define __USE_GNU
9 #endif
10 
11 /* For sched_setaffinity() */
12 #include <sched.h>
13 
14 
15 int main( int argc, char **argv ) {
16 
17  int retval;
18  int EventSet1 = PAPI_NULL;
19  int EventSet2 = PAPI_NULL;
20  int EventSet3 = PAPI_NULL;
21  int EventSet4 = PAPI_NULL;
22  int EventSet5 = PAPI_NULL;
23  int EventSet6 = PAPI_NULL;
24  int EventSet7 = PAPI_NULL;
25  int EventSet8 = PAPI_NULL;
26  int EventSet9 = PAPI_NULL;
27  int EventSet10 = PAPI_NULL;
28 
29  PAPI_domain_option_t domain_opt;
31  PAPI_cpu_option_t cpu_opt;
32  cpu_set_t mask;
33 
34  long long dom_user_values[1],dom_userkernel_values[1],dom_all_values[1];
35  long long grn_thr_values[1],grn_proc_values[1];
36  long long grn_sys_values[1],grn_sys_cpu_values[1];
37  long long total_values[1],total_affinity_values[1];
38  long long total_all_values[1];
39 
40  dom_user_values[0]=0;
41  dom_userkernel_values[0]=0;
42  dom_all_values[0]=0;
43  grn_thr_values[0]=0;
44  grn_proc_values[0]=0;
45  grn_sys_values[0]=0;
46  grn_sys_cpu_values[0]=0;
47  total_values[0]=0;
48  total_affinity_values[0]=0;
49  total_all_values[0]=0;
50 
51  /* Set TESTS_QUIET variable */
52  tests_quiet( argc, argv );
53 
54  /* Init the PAPI library */
56  if ( retval != PAPI_VER_CURRENT ) {
57  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
58  }
59 
60  /***************************/
61  /***************************/
62  /* Default, user events */
63  /***************************/
64  /***************************/
65 
66  if (!TESTS_QUIET) {
67  printf("\nTrying PAPI_TOT_CYC with different domains:\n");
68  }
69 
70  if (!TESTS_QUIET) {
71  printf("\tPAPI_DOM_USER:\t\t\t");
72  }
73 
74  retval = PAPI_create_eventset(&EventSet1);
75  if (retval != PAPI_OK) {
76  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
77  }
78 
79  retval = PAPI_add_named_event(EventSet1, "PAPI_TOT_CYC");
80  if (retval != PAPI_OK) {
81  if ( !TESTS_QUIET ) {
82  fprintf(stderr,"Error trying to add PAPI_TOT_CYC\n");
83  }
84  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
85  }
86 
87  retval = PAPI_start( EventSet1 );
88  if ( retval != PAPI_OK ) {
89  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
90  }
91 
93 
94  retval = PAPI_stop( EventSet1, dom_user_values );
95  if ( retval != PAPI_OK ) {
96  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
97  }
98 
99  if ( !TESTS_QUIET ) {
100  printf("%lld\n",dom_user_values[0]);
101  }
102 
103 
104  /***************************/
105  /***************************/
106  /* User+Kernel events */
107  /***************************/
108  /***************************/
109 
110  if (!TESTS_QUIET) {
111  printf("\tPAPI_DOM_USER|PAPI_DOM_KERNEL:\t");
112  }
113 
114  retval = PAPI_create_eventset(&EventSet2);
115  if (retval != PAPI_OK) {
116  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
117  }
118 
119  retval = PAPI_assign_eventset_component(EventSet2, 0);
120 
121  /* we need to set domain to be as inclusive as possible */
122 
123  domain_opt.def_cidx=0;
124  domain_opt.eventset=EventSet2;
126 
127  retval = PAPI_set_opt(PAPI_DOMAIN,(PAPI_option_t*)&domain_opt);
128  if (retval != PAPI_OK) {
129 
130  if (retval==PAPI_EPERM) {
131  test_skip( __FILE__, __LINE__,
132  "this test; trying to set PAPI_DOM_ALL; need to run as root",
133  retval);
134  }
135  else {
136  test_fail(__FILE__, __LINE__, "setting PAPI_DOM_ALL",retval);
137  }
138  }
139 
140 
141  retval = PAPI_add_named_event(EventSet2, "PAPI_TOT_CYC");
142  if (retval != PAPI_OK) {
143  if ( !TESTS_QUIET ) {
144  fprintf(stderr,"Error trying to add PAPI_TOT_CYC\n");
145  }
146  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
147  }
148 
149  retval = PAPI_start( EventSet2 );
150  if ( retval != PAPI_OK ) {
151  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
152  }
153 
154  do_flops( NUM_FLOPS );
155 
156  retval = PAPI_stop( EventSet2, dom_userkernel_values );
157  if ( retval != PAPI_OK ) {
158  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
159  }
160 
161  if ( !TESTS_QUIET ) {
162  printf("%lld\n",dom_userkernel_values[0]);
163  }
164 
165  /***************************/
166  /***************************/
167  /* DOMAIN_ALL events */
168  /***************************/
169  /***************************/
170 
171  if (!TESTS_QUIET) {
172  printf("\tPAPI_DOM_ALL:\t\t\t");
173  }
174 
175  retval = PAPI_create_eventset(&EventSet3);
176  if (retval != PAPI_OK) {
177  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
178  }
179 
180  retval = PAPI_assign_eventset_component(EventSet3, 0);
181 
182  /* we need to set domain to be as inclusive as possible */
183 
184  domain_opt.def_cidx=0;
185  domain_opt.eventset=EventSet3;
186  domain_opt.domain=PAPI_DOM_ALL;
187 
188  retval = PAPI_set_opt(PAPI_DOMAIN,(PAPI_option_t*)&domain_opt);
189  if (retval != PAPI_OK) {
190 
191  if (retval==PAPI_EPERM) {
192  test_skip( __FILE__, __LINE__,
193  "this test; trying to set PAPI_DOM_ALL; need to run as root",
194  retval);
195  }
196  else {
197  test_fail(__FILE__, __LINE__, "setting PAPI_DOM_ALL",retval);
198  }
199  }
200 
201 
202  retval = PAPI_add_named_event(EventSet3, "PAPI_TOT_CYC");
203  if (retval != PAPI_OK) {
204  if ( !TESTS_QUIET ) {
205  fprintf(stderr,"Error trying to add PAPI_TOT_CYC\n");
206  }
207  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
208  }
209 
210  retval = PAPI_start( EventSet3 );
211  if ( retval != PAPI_OK ) {
212  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
213  }
214 
215  do_flops( NUM_FLOPS );
216 
217  retval = PAPI_stop( EventSet3, dom_all_values );
218  if ( retval != PAPI_OK ) {
219  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
220  }
221 
222  if ( !TESTS_QUIET ) {
223  printf("%lld\n",dom_all_values[0]);
224  }
225 
226 
227  /***************************/
228  /***************************/
229  /* PAPI_GRN_THR events */
230  /***************************/
231  /***************************/
232 
233  if ( !TESTS_QUIET ) {
234  printf("\nTrying different granularities:\n");
235  }
236 
237  if ( !TESTS_QUIET ) {
238  printf("\tPAPI_GRN_THR:\t\t\t");
239  }
240 
241  retval = PAPI_create_eventset(&EventSet4);
242  if (retval != PAPI_OK) {
243  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
244  }
245 
246  retval = PAPI_assign_eventset_component(EventSet4, 0);
247 
248  /* Set the granularity to system-wide */
249 
250  gran_opt.def_cidx=0;
251  gran_opt.eventset=EventSet4;
252  gran_opt.granularity=PAPI_GRN_THR;
253 
254  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
255  if (retval != PAPI_OK) {
256  test_skip( __FILE__, __LINE__,
257  "this test; trying to set PAPI_GRN_THR",
258  retval);
259  }
260 
261 
262  retval = PAPI_add_named_event(EventSet4, "PAPI_TOT_CYC");
263  if (retval != PAPI_OK) {
264  if ( !TESTS_QUIET ) {
265  fprintf(stderr,"Error trying to add PAPI_TOT_CYC\n");
266  }
267  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
268  }
269 
270  retval = PAPI_start( EventSet4 );
271  if ( retval != PAPI_OK ) {
272  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
273  }
274 
275  do_flops( NUM_FLOPS );
276 
277  retval = PAPI_stop( EventSet4, grn_thr_values );
278  if ( retval != PAPI_OK ) {
279  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
280  }
281 
282  if ( !TESTS_QUIET ) {
283  printf("%lld\n",grn_thr_values[0]);
284  }
285 
286 
287  /***************************/
288  /***************************/
289  /* PAPI_GRN_PROC events */
290  /***************************/
291  /***************************/
292 
293  if ( !TESTS_QUIET ) {
294  printf("\tPAPI_GRN_PROC:\t\t\t");
295  }
296 
297  retval = PAPI_create_eventset(&EventSet5);
298  if (retval != PAPI_OK) {
299  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
300  }
301 
302  retval = PAPI_assign_eventset_component(EventSet5, 0);
303 
304  /* Set the granularity to system-wide */
305 
306  gran_opt.def_cidx=0;
307  gran_opt.eventset=EventSet5;
308  gran_opt.granularity=PAPI_GRN_PROC;
309 
310  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
311  if (retval != PAPI_OK) {
312  if (!TESTS_QUIET) {
313  printf("Unable to set PAPI_GRN_PROC\n");
314  }
315  }
316  else {
317  retval = PAPI_add_named_event(EventSet5, "PAPI_TOT_CYC");
318  if (retval != PAPI_OK) {
319  if ( !TESTS_QUIET ) {
320  printf("Error trying to add PAPI_TOT_CYC\n");
321  }
322  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
323  }
324 
325  retval = PAPI_start( EventSet5 );
326  if ( retval != PAPI_OK ) {
327  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
328  }
329 
330  do_flops( NUM_FLOPS );
331 
332  retval = PAPI_stop( EventSet5, grn_proc_values );
333  if ( retval != PAPI_OK ) {
334  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
335  }
336 
337  if ( !TESTS_QUIET ) {
338  printf("%lld\n",grn_proc_values[0]);
339  }
340  }
341 
342 
343 
344  /***************************/
345  /***************************/
346  /* PAPI_GRN_SYS events */
347  /***************************/
348  /***************************/
349 
350  if ( !TESTS_QUIET ) {
351  printf("\tPAPI_GRN_SYS:\t\t\t");
352  }
353 
354  retval = PAPI_create_eventset(&EventSet6);
355  if (retval != PAPI_OK) {
356  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
357  }
358 
359  retval = PAPI_assign_eventset_component(EventSet6, 0);
360 
361  /* Set the granularity to system-wide */
362 
363  gran_opt.def_cidx=0;
364  gran_opt.eventset=EventSet6;
365  gran_opt.granularity=PAPI_GRN_SYS;
366 
367  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
368  if (retval != PAPI_OK) {
369  if (!TESTS_QUIET) {
370  printf("Unable to set PAPI_GRN_SYS\n");
371  }
372  }
373  else {
374  retval = PAPI_add_named_event(EventSet6, "PAPI_TOT_CYC");
375  if (retval != PAPI_OK) {
376  if ( !TESTS_QUIET ) {
377  printf("Error trying to add PAPI_TOT_CYC\n");
378  }
379  } else {
380 
381  retval = PAPI_start( EventSet6 );
382  if ( retval != PAPI_OK ) {
383  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
384  }
385 
386  do_flops( NUM_FLOPS );
387 
388  retval = PAPI_stop( EventSet6, grn_sys_values );
389  if ( retval != PAPI_OK ) {
390  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
391  }
392 
393  if ( !TESTS_QUIET ) {
394  printf("GRN_SYS PAPI_TOT_CYC: %lld\n",grn_sys_values[0]);
395  }
396  }
397 
398  }
399 
400 
401  /****************************/
402  /****************************/
403  /* PAPI_GRN_SYS_CPU events */
404  /****************************/
405  /****************************/
406 
407  if ( !TESTS_QUIET ) {
408  printf("\tPAPI_GRN_SYS_CPU:\t\t");
409  }
410 
411  retval = PAPI_create_eventset(&EventSet7);
412  if (retval != PAPI_OK) {
413  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
414  }
415 
416  retval = PAPI_assign_eventset_component(EventSet7, 0);
417 
418  /* Set the granularity to system-wide */
419 
420  gran_opt.def_cidx=0;
421  gran_opt.eventset=EventSet7;
422  gran_opt.granularity=PAPI_GRN_SYS_CPU;
423 
424  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
425  if (retval != PAPI_OK) {
426  if (!TESTS_QUIET) {
427  printf("Unable to set PAPI_GRN_SYS_CPU\n");
428  }
429  }
430  else {
431  retval = PAPI_add_named_event(EventSet7, "PAPI_TOT_CYC");
432  if (retval != PAPI_OK) {
433  if ( !TESTS_QUIET ) {
434  printf("Error trying to add PAPI_TOT_CYC\n");
435  }
436  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
437  }
438 
439  retval = PAPI_start( EventSet7 );
440  if ( retval != PAPI_OK ) {
441  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
442  }
443 
444  do_flops( NUM_FLOPS );
445 
446  retval = PAPI_stop( EventSet7, grn_sys_cpu_values );
447  if ( retval != PAPI_OK ) {
448  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
449  }
450 
451  if ( !TESTS_QUIET ) {
452  printf("%lld\n",grn_sys_cpu_values[0]);
453  }
454  }
455 
456 
457  /***************************/
458  /***************************/
459  /* SYS and ATTACH events */
460  /***************************/
461  /***************************/
462 
463  if ( !TESTS_QUIET ) {
464  printf("\nPAPI_GRN_SYS plus CPU attach:\n");
465  }
466 
467  if ( !TESTS_QUIET ) {
468  printf("\tGRN_SYS, DOM_USER, CPU 0 attach:\t");
469  }
470 
471  retval = PAPI_create_eventset(&EventSet8);
472  if (retval != PAPI_OK) {
473  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
474  }
475 
476  retval = PAPI_assign_eventset_component(EventSet8, 0);
477 
478  /* Set the granularity to system-wide */
479 
480  gran_opt.def_cidx=0;
481  gran_opt.eventset=EventSet8;
482  gran_opt.granularity=PAPI_GRN_SYS;
483 
484  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
485  if (retval != PAPI_OK) {
486  if (!TESTS_QUIET) {
487  printf("Unable to set PAPI_GRN_SYS\n");
488  }
489  }
490  else {
491  /* we need to set to a certain cpu */
492 
493  cpu_opt.eventset=EventSet8;
494  cpu_opt.cpu_num=0;
495 
496  retval = PAPI_set_opt(PAPI_CPU_ATTACH,(PAPI_option_t*)&cpu_opt);
497  if (retval != PAPI_OK) {
498  if (retval==PAPI_EPERM) {
499  test_skip( __FILE__, __LINE__,
500  "this test; trying to CPU_ATTACH; need to run as root",
501  retval);
502  }
503 
504  test_fail(__FILE__, __LINE__, "PAPI_CPU_ATTACH",retval);
505  }
506 
507  retval = PAPI_add_named_event(EventSet8, "PAPI_TOT_CYC");
508  if (retval != PAPI_OK) {
509  if ( !TESTS_QUIET ) {
510  printf("Error trying to add PAPI_TOT_CYC\n");
511  }
512  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
513  }
514 
515  retval = PAPI_start( EventSet8 );
516  if ( retval != PAPI_OK ) {
517  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
518  }
519 
520  do_flops( NUM_FLOPS );
521 
522  retval = PAPI_stop( EventSet8, total_values );
523  if ( retval != PAPI_OK ) {
524  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
525  }
526 
527  if ( !TESTS_QUIET ) {
528  printf("%lld\n",total_values[0]);
529  }
530  }
531 
532 
533  /***************************/
534  /***************************/
535  /* SYS and ATTACH, bind CPU events */
536  /***************************/
537  /***************************/
538 
539  if ( !TESTS_QUIET ) {
540  printf("\tGRN_SYS, DOM_USER, CPU 0 affinity:\t");
541  }
542 
543  /* Set affinity to CPU 0 */
544  CPU_ZERO(&mask);
545  CPU_SET(0,&mask);
546  retval=sched_setaffinity(0, sizeof(mask), &mask);
547 
548  if (retval<0) {
549  if (!TESTS_QUIET) {
550  printf("Setting affinity failed: %s\n",strerror(errno));
551  }
552  } else {
553 
554  retval = PAPI_create_eventset(&EventSet9);
555  if (retval != PAPI_OK) {
556  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
557  }
558 
559  retval = PAPI_assign_eventset_component(EventSet9, 0);
560 
561  /* Set the granularity to system-wide */
562 
563  gran_opt.def_cidx=0;
564  gran_opt.eventset=EventSet9;
565  gran_opt.granularity=PAPI_GRN_SYS;
566 
567  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
568  if (retval != PAPI_OK) {
569  if (!TESTS_QUIET) {
570  printf("Unable to set PAPI_GRN_SYS\n");
571  }
572  }
573  else {
574  /* we need to set to a certain cpu for uncore to work */
575 
576  cpu_opt.eventset=EventSet9;
577  cpu_opt.cpu_num=0;
578 
579  retval = PAPI_set_opt(PAPI_CPU_ATTACH,(PAPI_option_t*)&cpu_opt);
580  if (retval != PAPI_OK) {
581  test_fail(__FILE__, __LINE__, "PAPI_CPU_ATTACH",retval);
582  }
583 
584  retval = PAPI_add_named_event(EventSet9, "PAPI_TOT_CYC");
585  if (retval != PAPI_OK) {
586  if ( !TESTS_QUIET ) {
587  printf("Error trying to add PAPI_TOT_CYC\n");
588  }
589  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
590  }
591 
592  retval = PAPI_start( EventSet9 );
593  if ( retval != PAPI_OK ) {
594  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
595  }
596 
597  do_flops( NUM_FLOPS );
598 
599  retval = PAPI_stop( EventSet9, total_affinity_values );
600  if ( retval != PAPI_OK ) {
601  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
602  }
603 
604  if ( !TESTS_QUIET ) {
605  printf("%lld\n",total_affinity_values[0]);
606  }
607  }
608  }
609 
610  /***************************/
611  /***************************/
612  /* SYS and ATTACH, bind CPU events */
613  /***************************/
614  /***************************/
615 
616  if ( !TESTS_QUIET ) {
617  printf("\tGRN_SYS, DOM_ALL, CPU 0 affinity:\t");
618  }
619 
620 
621 
622  /* Set affinity to CPU 0 */
623  CPU_ZERO(&mask);
624  CPU_SET(0,&mask);
625  retval=sched_setaffinity(0, sizeof(mask), &mask);
626 
627  if (retval<0) {
628  if (!TESTS_QUIET) {
629  printf("Setting affinity failed: %s\n",strerror(errno));
630  }
631  } else {
632 
633  retval = PAPI_create_eventset(&EventSet10);
634  if (retval != PAPI_OK) {
635  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
636  }
637 
638  retval = PAPI_assign_eventset_component(EventSet10, 0);
639 
640  /* Set DOM_ALL */
641  domain_opt.def_cidx=0;
642  domain_opt.eventset=EventSet10;
643  domain_opt.domain=PAPI_DOM_ALL;
644 
645  retval = PAPI_set_opt(PAPI_DOMAIN,(PAPI_option_t*)&domain_opt);
646  if (retval != PAPI_OK) {
647 
648  if (retval==PAPI_EPERM) {
649  test_skip( __FILE__, __LINE__,
650  "this test; trying to set PAPI_DOM_ALL; need to run as root",
651  retval);
652  }
653  else {
654  test_fail(__FILE__, __LINE__, "setting PAPI_DOM_ALL",retval);
655  }
656  }
657 
658  /* Set the granularity to system-wide */
659 
660  gran_opt.def_cidx=0;
661  gran_opt.eventset=EventSet10;
662  gran_opt.granularity=PAPI_GRN_SYS;
663 
664  retval = PAPI_set_opt(PAPI_GRANUL,(PAPI_option_t*)&gran_opt);
665  if (retval != PAPI_OK) {
666  if (!TESTS_QUIET) {
667  printf("Unable to set PAPI_GRN_SYS\n");
668  }
669  }
670  else {
671  /* we need to set to a certain cpu for uncore to work */
672 
673  cpu_opt.eventset=EventSet10;
674  cpu_opt.cpu_num=0;
675 
676  retval = PAPI_set_opt(PAPI_CPU_ATTACH,(PAPI_option_t*)&cpu_opt);
677  if (retval != PAPI_OK) {
678  test_fail(__FILE__, __LINE__, "PAPI_CPU_ATTACH",retval);
679  }
680 
681  retval = PAPI_add_named_event(EventSet10, "PAPI_TOT_CYC");
682  if (retval != PAPI_OK) {
683  if ( !TESTS_QUIET ) {
684  printf("Error trying to add PAPI_TOT_CYC\n");
685  }
686  test_fail(__FILE__, __LINE__, "adding PAPI_TOT_CYC ",retval);
687  }
688 
689  retval = PAPI_start( EventSet10 );
690  if ( retval != PAPI_OK ) {
691  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
692  }
693 
694  do_flops( NUM_FLOPS );
695 
696  retval = PAPI_stop( EventSet10, total_all_values );
697  if ( retval != PAPI_OK ) {
698  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
699  }
700 
701  if ( !TESTS_QUIET ) {
702  printf("%lld\n",total_all_values[0]);
703  }
704  }
705  }
706 
707  /**************/
708  /* Validation */
709  /**************/
710 
711  if ( !TESTS_QUIET ) {
712  printf("\n");
713  }
714 
715  if ( !TESTS_QUIET ) {
716  printf("Validating:\n");
717  printf("\tDOM_USER|DOM_KERNEL (%lld) > DOM_USER (%lld)\n",
718  dom_userkernel_values[0],dom_user_values[0]);
719  }
720  if (dom_user_values[0] > dom_userkernel_values[0]) {
721  test_fail( __FILE__, __LINE__, "DOM_USER too high", 0 );
722  }
723 
724  if ( !TESTS_QUIET ) {
725  printf("\n");
726  }
727 
728  test_pass( __FILE__, NULL, 0 );
729 
730  return 0;
731 }
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2232
#define NUM_FLOPS
int errno
#define PAPI_GRN_SYS_CPU
Definition: fpapi.h:72
#define PAPI_CPU_ATTACH
Definition: papi.h:455
#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
#define PAPI_EPERM
Definition: fpapi.h:120
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
#define PAPI_GRN_SYS
Definition: fpapi.h:71
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
#define PAPI_GRN_PROC
Definition: fpapi.h:69
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:843
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int PAPI_set_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:3371
int int argc
Definition: iozone.c:1609
unsigned int cpu_num
Definition: papi.h:819
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_VER_CURRENT
Definition: fpapi.h:14
#define PAPI_DOMAIN
Definition: fpapi.h:50
int EventSet2
Definition: rapl_overflow.c:12
#define PAPI_GRANUL
Definition: fpapi.h:52
int PAPI_assign_eventset_component(int EventSet, int cidx)
Definition: papi.c:1467
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1406
void do_flops(int n)
Definition: multiplex.c:23
#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.
#define PAPI_GRN_THR
Definition: fpapi.h:67
int EventSet1
Definition: zero_fork.c:40