PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
second.c
Go to the documentation of this file.
1 /* This file performs the following test: counter domain testing
2 
3  - It attempts to use the following two counters. It may use less depending on
4  hardware counter resource limitations.
5  + PAPI_TOT_INS
6  + PAPI_TOT_CYC
7  - Start system domain counters
8  - Do flops
9  - Stop and read system domain counters
10  - Start kernel domain counters
11  - Do flops
12  - Stop and read kernel domain counters
13  - Start user domain counters
14  - Do flops
15  - Stop and read user domain counters
16 */
17 
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 
22 #include "papi.h"
23 #include "papi_test.h"
24 
25 #include "do_loops.h"
26 
27 #define TAB_DOM "%s%12lld%15lld%17lld\n"
28 
29 #define CASE2 0
30 #define CREATE 1
31 #define ADD 2
32 #define MIDDLE 3
33 #define CHANGE 4
34 #define SUPERVISOR 5
35 
36 void
37 dump_and_verify( int test_case, long long **values )
38 {
39  long long min, max, min2, max2;
40 
41  if (!TESTS_QUIET) {
42  printf( "-----------------------------------------------------------------\n" );
43  printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
44  printf( "-------------------------------------------------------------\n" );
45  }
46  if ( test_case == CASE2 ) {
47  if (!TESTS_QUIET) {
48  printf( "Test type : Before Create Before Add Between Adds\n" );
49  printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[0] )[0], ( values[1] )[0],
50  ( values[2] )[0] );
51  printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[0] )[1], ( values[1] )[1],
52  ( values[2] )[1] );
53  printf( "-------------------------------------------------------------\n" );
54  printf( "Verification:\n" );
55  printf( "Both rows equal 'n N N' where n << N\n" );
56  return;
57  }
58  } else if ( test_case == CHANGE ) {
59  min = ( long long ) ( ( double ) values[0][0] * ( 1 - TOLERANCE ) );
60  max = ( long long ) ( ( double ) values[0][0] * ( 1 + TOLERANCE ) );
61  if ( values[1][0] > max || values[1][0] < min )
62  test_fail( __FILE__, __LINE__, "PAPI_TOT_INS", 1 );
63 
64  min = ( long long ) ( ( double ) values[1][1] * ( 1 - TOLERANCE ) );
65  max = ( long long ) ( ( double ) values[1][1] * ( 1 + TOLERANCE ) );
66  if ( ( values[2][1] + values[0][1] ) > max ||
67  ( values[2][1] + values[0][1] ) < min )
68  test_fail( __FILE__, __LINE__, "PAPI_TOT_CYC", 1 );
69 
70  if (!TESTS_QUIET) {
71  printf( "Test type : PAPI_DOM_ALL PAPI_DOM_KERNEL PAPI_DOM_USER\n" );
72  printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[1] )[0], ( values[2] )[0],
73  ( values[0] )[0] );
74  printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[1] )[1], ( values[2] )[1],
75  ( values[0] )[1] );
76  printf( "-------------------------------------------------------------\n" );
77 
78  printf( "Verification:\n" );
79  printf( "Both rows approximately equal '(N+n) n N', where n << N\n" );
80  printf( "Column 1 approximately equals column 2 plus column 3\n" );
81  }
82  } else if ( test_case == SUPERVISOR ) {
83  if (!TESTS_QUIET) {
84  printf( "Test type : PAPI_DOM_ALL All-minus-supervisor Supervisor-only\n" );
85  printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[0] )[0], ( values[1] )[0],
86  ( values[2] )[0] );
87  printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[0] )[1], ( values[1] )[1],
88  ( values[2] )[1] );
89  printf( "-------------------------------------------------------------\n" );
90  printf( "Verification:\n" );
91  printf( "Both rows approximately equal '(N+n) n N', where n << N\n" );
92  printf( "Column 1 approximately equals column 2 plus column 3\n" );
93  }
94  } else {
95  min = ( long long ) ( ( double ) values[2][0] * ( 1 - TOLERANCE ) );
96  max = ( long long ) ( ( double ) values[2][0] * ( 1 + TOLERANCE ) );
97 
98  min2 = ( long long ) ( ( double ) values[0][1] * ( 1 - TOLERANCE ) );
99  max2 =
100  ( long long ) ( ( double ) ( double ) values[0][1] *
101  ( 1 + TOLERANCE ) );
102 
103  if (!TESTS_QUIET) {
104  printf( "Test type : PAPI_DOM_ALL PAPI_DOM_KERNEL PAPI_DOM_USER\n" );
105  printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[0] )[0], ( values[1] )[0],
106  ( values[2] )[0] );
107  printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[0] )[1], ( values[1] )[1],
108  ( values[2] )[1] );
109  printf( "-------------------------------------------------------------\n" );
110  printf( "Verification:\n" );
111  printf( "Both rows approximately equal '(N+n) n N', where n << N\n" );
112  printf( "Column 1 approximately equals column 2 plus column 3\n" );
113  }
114  if ( values[0][0] > max || values[0][0] < min )
115  test_fail( __FILE__, __LINE__, "PAPI_TOT_INS", 1 );
116 
117  if ( ( values[1][1] + values[2][1] ) > max2 ||
118  ( values[1][1] + values[2][1] ) < min2 )
119  test_fail( __FILE__, __LINE__, "PAPI_TOT_CYC", 1 );
120  }
121 
122  if ( values[0][0] == 0 || values[0][1] == 0 ||
123  values[1][0] == 0 || values[1][1] == 0 )
124  test_fail( __FILE__, __LINE__,
125  "Verify non-zero count for all domain types", 1 );
126 
127  if ( values[2][0] == 0 || values[2][1] == 0 ) {
128  if ( test_case == SUPERVISOR ) {
129  if (!TESTS_QUIET) printf( "WARNING: No events counted in supervisor context. This is expected in a non-virtualized environment.\n" );
130  } else {
131  test_fail( __FILE__, __LINE__,
132  "Verify non-zero count for all domain types", 1 );
133  }
134  }
135 }
136 
137 /* Do the set_domain on the eventset before adding events */
138 
139 void
140 case1( int num )
141 {
142  int retval, num_tests = 3;
143  long long **values;
144  int EventSet1 = PAPI_NULL, EventSet2 = PAPI_NULL, EventSet3 = PAPI_NULL;
146  const PAPI_component_info_t *cmpinfo;
147 
148  memset( &options, 0x0, sizeof ( options ) );
149 
151  if ( retval != PAPI_VER_CURRENT )
152  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
153 
154  /* get info from cpu component */
155  cmpinfo = PAPI_get_component_info( 0 );
156  if ( cmpinfo == NULL ) {
157  test_fail( __FILE__, __LINE__,"PAPI_get_component_info", PAPI_ECMP);
158  }
159 
160  if ( ( retval = PAPI_query_event( PAPI_TOT_INS ) ) != PAPI_OK )
161  test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
162 
163  if ( ( retval = PAPI_query_event( PAPI_TOT_CYC ) ) != PAPI_OK )
164  test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
165 
166  retval = PAPI_create_eventset( &EventSet1 );
167  if ( retval == PAPI_OK )
168  retval = PAPI_create_eventset( &EventSet2 );
169  if ( retval == PAPI_OK )
170  retval = PAPI_create_eventset( &EventSet3 );
171  if ( retval != PAPI_OK )
172  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
173 
174  /* In Component PAPI, EventSets must be assigned a component index
175  before you can fiddle with their internals. 0 is always the cpu component */
176  retval = PAPI_assign_eventset_component( EventSet1, 0 );
177  if ( retval == PAPI_OK )
178  retval = PAPI_assign_eventset_component( EventSet2, 0 );
179  if ( retval == PAPI_OK )
180  retval = PAPI_assign_eventset_component( EventSet3, 0 );
181  if ( retval != PAPI_OK )
182  test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component",
183  retval );
184 
185  if ( num == CREATE ) {
186  if (!TESTS_QUIET) printf( "\nTest case CREATE: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet before add\n" );
187  options.domain.eventset = EventSet1;
188  options.domain.domain = PAPI_DOM_ALL;
189 
190  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
191  if ( retval != PAPI_OK )
192  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
193 
194  options.domain.eventset = EventSet2;
195  options.domain.domain = PAPI_DOM_KERNEL;
196 
197  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
198  if ( retval != PAPI_OK )
199  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
200 
201  options.domain.eventset = EventSet3;
202  options.domain.domain = PAPI_DOM_USER;
203 
204  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
205  if ( retval != PAPI_OK )
206  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
207  }
208 
209  retval = PAPI_add_event( EventSet1, PAPI_TOT_INS );
210  if ( retval != PAPI_OK )
211  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
212 
213  retval = PAPI_add_event( EventSet1, PAPI_TOT_CYC );
214  if ( retval != PAPI_OK )
215  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
216 
217  retval = PAPI_add_event( EventSet2, PAPI_TOT_INS );
218  if ( retval != PAPI_OK )
219  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
220 
221  retval = PAPI_add_event( EventSet2, PAPI_TOT_CYC );
222  if ( retval != PAPI_OK )
223  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
224 
225  retval = PAPI_add_event( EventSet3, PAPI_TOT_INS );
226  if ( retval != PAPI_OK )
227  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
228 
229  if ( num == MIDDLE ) {
230  if (!TESTS_QUIET) printf( "\nTest case MIDDLE: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet between adds\n" );
231  options.domain.eventset = EventSet1;
232  options.domain.domain = PAPI_DOM_ALL;
233 
234  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
235  if ( retval != PAPI_OK && retval != PAPI_ECMP ) {
236  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
237  }
238 
239  options.domain.eventset = EventSet2;
240  options.domain.domain = PAPI_DOM_KERNEL;
241 
242  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
243  if ( retval != PAPI_OK )
244  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
245 
246  options.domain.eventset = EventSet3;
247  options.domain.domain = PAPI_DOM_USER;
248 
249  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
250  if ( retval != PAPI_OK )
251  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
252  }
253 
254  retval = PAPI_add_event( EventSet3, PAPI_TOT_CYC );
255  if ( retval != PAPI_OK )
256  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
257 
258  if ( num == ADD ) {
259  if (!TESTS_QUIET) printf( "\nTest case ADD: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet after add\n" );
260  options.domain.eventset = EventSet1;
261  options.domain.domain = PAPI_DOM_ALL;
262 
263  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
264  if ( retval != PAPI_OK && retval != PAPI_ECMP ) {
265  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
266  }
267  options.domain.eventset = EventSet2;
268  options.domain.domain = PAPI_DOM_KERNEL;
269 
270  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
271  if ( retval != PAPI_OK )
272  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
273 
274  options.domain.eventset = EventSet3;
275  options.domain.domain = PAPI_DOM_USER;
276 
277  retval = PAPI_set_opt( PAPI_DOMAIN, &options );
278  if ( retval != PAPI_OK )
279  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
280  }
281 
282  /* 2 events */
283 
284  values = allocate_test_space( num_tests, 2 );
285 
286  if ( num == CHANGE ) {
287  /* This testcase is dependent on the CREATE testcase running immediately before it, using
288  * domain settings of "All", "Kernel" and "User", on event sets 1, 2, and 3, respectively.
289  */
290  PAPI_option_t option;
291  if (!TESTS_QUIET) printf( "\nTest case CHANGE 1: Change domain on EventSet between runs, using generic domain options:\n" );
292  PAPI_start( EventSet1 );
293  PAPI_stop( EventSet1, values[0] );
294 
295  // change EventSet1 domain from All to User
296  option.domain.domain = PAPI_DOM_USER;
297  option.domain.eventset = EventSet1;
298  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
299  if ( retval != PAPI_OK )
300  test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
301 
302  PAPI_start( EventSet2 );
303  PAPI_stop( EventSet2, values[1] );
304 
305  // change EventSet2 domain from Kernel to All
306  option.domain.domain = PAPI_DOM_ALL;
307  option.domain.eventset = EventSet2;
308  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
309  if ( retval != PAPI_OK )
310  test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
311 
312  PAPI_start( EventSet3 );
313  PAPI_stop( EventSet3, values[2] );
314 
315  // change EventSet3 domain from User to Kernel
316  option.domain.domain = PAPI_DOM_KERNEL;
317  option.domain.eventset = EventSet3;
318  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
319  if ( retval != PAPI_OK )
320  test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
321 
322  free_test_space( values, num_tests );
323  values = allocate_test_space( num_tests, 2 );
324 
325  }
326 
327  if ( num == SUPERVISOR &&
328  ( cmpinfo->available_domains & PAPI_DOM_SUPERVISOR ) ) {
329  PAPI_option_t option;
330 
331  if (!TESTS_QUIET) printf( "\nTest case CHANGE 2: Change domain on EventSets to include/exclude supervisor events:\n" );
332 
333  option.domain.domain = PAPI_DOM_ALL;
334  option.domain.eventset = EventSet1;
335  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
336  if ( retval != PAPI_OK )
337  test_fail( __FILE__, __LINE__, "PAPI_set_domain ALL ", retval );
338 
340  option.domain.eventset = EventSet2;
341  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
342  if ( retval != PAPI_OK ) {
343 
344  /* DOM_ALL is special-cased as domains_available */
345  /* in papi.c . Some machines don't like DOM_OTHER */
346  /* so try that if the above case fails. */
347  option.domain.domain ^= PAPI_DOM_OTHER;
348  option.domain.eventset = EventSet2;
349  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
350 
351  if (retval != PAPI_OK) {
352  test_fail( __FILE__, __LINE__, "PAPI_set_domain ALL^SUPERVISOR ", retval );
353  }
354  }
355 
357  option.domain.eventset = EventSet3;
358  retval = PAPI_set_opt( PAPI_DOMAIN, &option );
359  if ( retval != PAPI_OK )
360  test_fail( __FILE__, __LINE__, "PAPI_set_domain SUPERVISOR ", retval );
361 
362  free_test_space( values, num_tests );
363  values = allocate_test_space( num_tests, 2 );
364  }
365  /* Warm it up dude */
366 
367  PAPI_start( EventSet1 );
368  do_flops( NUM_FLOPS );
369  PAPI_stop( EventSet1, NULL );
370 
371  retval = PAPI_start( EventSet1 );
372  if ( retval != PAPI_OK )
373  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
374 
375  do_flops( NUM_FLOPS );
376 
377  retval = PAPI_stop( EventSet1, values[0] );
378  if ( retval != PAPI_OK )
379  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
380 
381  retval = PAPI_start( EventSet2 );
382 
383  do_flops( NUM_FLOPS );
384 
385  if ( retval == PAPI_OK ) {
386  retval = PAPI_stop( EventSet2, values[1] );
387  if ( retval != PAPI_OK )
388  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
389  } else {
390  values[1][0] = retval;
391  values[1][1] = retval;
392  }
393 
394  retval = PAPI_start( EventSet3 );
395  if ( retval != PAPI_OK )
396  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
397 
398  do_flops( NUM_FLOPS );
399 
400  retval = PAPI_stop( EventSet3, values[2] );
401  if ( retval != PAPI_OK )
402  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
403 
404  retval = PAPI_cleanup_eventset( EventSet1 );
405  if ( retval != PAPI_OK )
406  test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
407 
408  retval = PAPI_destroy_eventset( &EventSet1 );
409  if ( retval != PAPI_OK )
410  test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
411 
412  retval = PAPI_cleanup_eventset( EventSet2 );
413  if ( retval != PAPI_OK )
414  test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
415 
416  retval = PAPI_destroy_eventset( &EventSet2 );
417  if ( retval != PAPI_OK )
418  test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
419 
420  retval = PAPI_cleanup_eventset( EventSet3 );
421  if ( retval != PAPI_OK )
422  test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
423 
424  retval = PAPI_destroy_eventset( &EventSet3 );
425  if ( retval != PAPI_OK )
426  test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
427 
428  dump_and_verify( num, values );
429 
430  free(values);
431 
432  PAPI_shutdown( );
433 }
434 
435 void
436 case2( int num, int domain, long long *values )
437 {
438  int retval;
439  int EventSet1 = PAPI_NULL;
441 
442  memset( &options, 0x0, sizeof ( options ) );
443 
445  if ( retval != PAPI_VER_CURRENT )
446  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
447 
448  if ( ( retval = PAPI_query_event( PAPI_TOT_INS ) ) != PAPI_OK )
449  test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
450 
451  if ( ( retval = PAPI_query_event( PAPI_TOT_CYC ) ) != PAPI_OK )
452  test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
453 
454  if ( num == CREATE ) {
455  if (!TESTS_QUIET) {
456  printf( "\nTest case 2, CREATE: Call PAPI_set_domain(%s) before create\n",
457  stringify_domain( domain ) );
458  printf( "This should override the domain setting for this EventSet.\n" );
459  }
460  retval = PAPI_set_domain( domain );
461  if ( retval != PAPI_OK )
462  test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
463  }
464 
465  retval = PAPI_create_eventset( &EventSet1 );
466  if ( retval != PAPI_OK )
467  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
468 
469  if ( num == ADD ) {
470  if (!TESTS_QUIET) {
471  printf( "\nTest case 2, ADD: Call PAPI_set_domain(%s) before add\n",
472  stringify_domain( domain ) );
473  printf( "This should have no effect on the domain setting for this EventSet.\n" );
474  }
475 
476  retval = PAPI_set_domain( domain );
477  if ( retval != PAPI_OK )
478  test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
479  }
480 
481  retval = PAPI_add_event( EventSet1, PAPI_TOT_INS );
482  if ( retval != PAPI_OK )
483  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
484 
485  if ( num == MIDDLE ) {
486  if (!TESTS_QUIET) {
487  printf( "\nTest case 2, MIDDLE: Call PAPI_set_domain(%s) between adds\n",
488  stringify_domain( domain ) );
489  printf( "This should have no effect on the domain setting for this EventSet.\n" );
490  }
491 
492  retval = PAPI_set_domain( domain );
493  if ( retval != PAPI_OK )
494  test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
495  }
496 
497  retval = PAPI_add_event( EventSet1, PAPI_TOT_CYC );
498  if ( retval != PAPI_OK )
499  test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
500 
501 
502  /* Warm it up dude */
503 
504  PAPI_start( EventSet1 );
505  do_flops( NUM_FLOPS );
506  PAPI_stop( EventSet1, NULL );
507 
508  retval = PAPI_start( EventSet1 );
509  if ( retval != PAPI_OK )
510  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
511 
512  do_flops( NUM_FLOPS );
513 
514  retval = PAPI_stop( EventSet1, values );
515  if ( retval != PAPI_OK )
516  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
517 
518  retval = PAPI_cleanup_eventset( EventSet1 );
519  if ( retval != PAPI_OK )
520  test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
521 
522  retval = PAPI_destroy_eventset( &EventSet1 );
523  if ( retval != PAPI_OK )
524  test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
525 
526  PAPI_shutdown( );
527 }
528 
529 void
531 {
532  long long **values;
533 
534  /* 3 tests, 2 events */
535 
536  values = allocate_test_space( 3, 2 );
537 
538  case2( CREATE, PAPI_DOM_KERNEL, values[0] );
539  case2( ADD, PAPI_DOM_KERNEL, values[1] );
540  case2( MIDDLE, PAPI_DOM_KERNEL, values[2] );
541 
542  dump_and_verify( CASE2, values );
543 
544  free(values);
545 }
546 
547 void
549 {
550  case1( ADD );
551  case1( MIDDLE );
552  case1( CREATE );
553  case1( CHANGE );
554  case1( SUPERVISOR );
555 }
556 
557 int
558 main( int argc, char **argv )
559 {
560  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
561 
562 #if defined(sgi) && defined(host_mips)
563  uid_t id;
564  id = getuid( );
565  if ( id != 0 ) {
566  printf( "IRIX requires root for PAPI_DOM_KERNEL and PAPI_DOM_ALL.\n" );
567  test_skip( __FILE__, __LINE__, "", 1 );
568  }
569 #endif
570 
571  if (!TESTS_QUIET) {
572  printf( "Test second.c: set domain of eventset via PAPI_set_domain and PAPI_set_opt.\n\n" );
573  printf( "* PAPI_set_domain(DOMAIN) sets the default domain \napplied to subsequently created EventSets.\n" );
574  printf( "It should have no effect on existing EventSets.\n\n" );
575  printf( "* PAPI_set_opt(DOMAIN,xxx) sets the domain for a specific EventSet.\n" );
576  printf( "It should always override the default setting for that EventSet.\n" );
577  }
578 
579  case2_driver( );
580  case1_driver( );
581 
582  test_pass( __FILE__ );
583 
584  return 0;
585 }
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
off64_t max
Definition: libasync.c:331
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:796
void test_pass(const char *filename)
Definition: test_utils.c:432
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1663
#define TOLERANCE
Definition: do_loops.h:13
#define CASE2
Definition: second.c:29
#define PAPI_NULL
Definition: papi.h:292
#define PAPI_DOM_KERNEL
Definition: papi.h:300
#define PAPI_TOT_INS
#define PAPI_DOM_ALL
Definition: papi.h:303
return PAPI_OK
Definition: linux-nvml.c:497
#define CHANGE
Definition: second.c:33
#define PAPI_DOM_USER
Definition: papi.h:298
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:848
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
static double
Definition: fileop.c:1281
int PAPI_set_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:3465
int int argc
Definition: iozone.c:1609
int case2(void)
Definition: multiplex1.c:151
Return codes and api definitions.
void test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:559
char ** argv
Definition: iozone.c:1610
int PAPI_library_init(int version)
Definition: papi.c:500
void PAPI_shutdown(void)
Definition: papi.c:4461
#define PAPI_TOT_CYC
free(dummyfile[xx])
void int num
Definition: iozone.c:22151
long long
Definition: iozone.c:19827
#define ADD
Definition: second.c:31
void free_test_space(long long **values, int num_tests)
Definition: test_utils.c:70
#define MIDDLE
Definition: second.c:32
#define PAPI_ECMP
Definition: papi.h:256
#define min(x, y)
Definition: darwin-common.h:4
int EventSet2
Definition: rapl_overflow.c:16
#define SUPERVISOR
Definition: second.c:34
int PAPI_cleanup_eventset(int EventSet)
Definition: papi.c:2890
int PAPI_assign_eventset_component(int EventSet, int cidx)
Definition: papi.c:1526
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1464
int num_tests
Definition: zero_fork.c:53
#define PAPI_DOMAIN
Definition: papi.h:433
void dump_and_verify(int test_case, long long **values)
Definition: second.c:37
void do_flops(int n)
Definition: multiplex.c:23
int PAPI_query_event(int EventCode)
Definition: papi.c:684
printf("\tTry: -i 0 -i 1 \n\n")
int TESTS_QUIET
Definition: test_utils.c:18
void case2_driver(void)
Definition: second.c:530
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
#define CREATE
Definition: second.c:30
static options_t options
int PAPI_destroy_eventset(int *EventSet)
Definition: papi.c:2014
PAPI_domain_option_t domain
Definition: papi.h:855
char * stringify_domain(int domain)
Definition: test_utils.c:312
int PAPI_set_domain(int domain)
Definition: papi.c:5688
#define PAPI_DOM_OTHER
Definition: papi.h:301
#define PAPI_DOM_SUPERVISOR
Definition: papi.h:302
void case1_driver(void)
Definition: second.c:548
int PAPI_start(int EventSet)
Definition: papi.c:2096
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
#define PAPI_VER_CURRENT
Definition: papi.h:225
int main(int argc, char **argv)
List all appio events codes and names.
int case1(void)
Definition: multiplex1.c:102
int EventSet1
Definition: zero_fork.c:47
#define TAB_DOM
Definition: second.c:27