PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
multiplex_cost.c File Reference
Include dependency graph for multiplex_cost.c:

Go to the source code of this file.

Data Structures

struct  options_t
 

Functions

void do_output (char *fn, char *message, long long *array, int noc)
 
void init_test (int SoftwareMPX, int KernelMPX, int *Events)
 
void finalize_test (void)
 
static void usage (void)
 
int main (int argc, char **argv)
 

Variables

static int first_time = 1
 
static int skip = 0
 
static FILE * fp
 
static options_t options
 

Function Documentation

void do_output ( char *  fn,
char *  message,
long long array,
int  noc 
)

Definition at line 61 of file multiplex_cost.c.

62 {
63  long long min, max;
64  double average, std;
65 
66  std = do_stats( array, &min, &max, &average );
67 
68  if ( first_time ) {
69  skip = 0;
70 
71  fp = fopen(fn, "w");
72  if (fp == NULL) {
73  fprintf(stderr,"Unable to open output file, %s, output will not be saved.\n", fn);
74  skip = 1;
75  } else
76  fprintf(fp, "###%s\n#number of events\tmin cycles\tmax cycles\tmean cycles\t\
77 std deviation\tsw min cycles\tsw max cycles\tsw avg cycles\tsw std dev\n", message);
78 
79  first_time = 0;
80  }
81 
82  if ( !skip ) {
83  fprintf(fp, "%20d\t%10lld\t%10lld\t%10lf\t%10lf", noc, min, max, average, std);
84 
85  std = do_stats( array+num_iters, &min, &max, &average );
86  fprintf(fp, "\t%10lld\t%10lld\t%10lf\t%10lf\n", min, max, average, std);
87  fflush(fp);
88  }
89 }
off64_t max
Definition: libasync.c:331
volatile int num_iters
fflush(stdout)
double do_stats(long long *array, long long *min, long long *max, double *average)
Definition: cost_utils.c:7
int first_time
static FILE * fp
#define min(x, y)
Definition: darwin-common.h:4
static int skip

Here is the call graph for this function:

Here is the caller graph for this function:

void finalize_test ( void  )

Definition at line 134 of file multiplex_cost.c.

135 {
136  if (fp)
137  fclose(fp);
138  first_time = 1;
139 }
fclose(thread_wqfd)
int first_time
static FILE * fp

Here is the call graph for this function:

Here is the caller graph for this function:

void init_test ( int  SoftwareMPX,
int  KernelMPX,
int Events 
)

Definition at line 92 of file multiplex_cost.c.

93 {
94  int i;
95  int retval;
96  PAPI_option_t option, itimer;
97 
98  if ( ( retval = PAPI_assign_eventset_component( SoftwareMPX, 0 ) ) != PAPI_OK )
99  test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component", retval);
100 
101  if ( ( retval = PAPI_assign_eventset_component( KernelMPX, 0 ) ) != PAPI_OK )
102  test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component", retval);
103 
104  if ( ( retval = PAPI_set_multiplex( KernelMPX ) ) != PAPI_OK )
105  test_fail( __FILE__, __LINE__, "PAPI_set_multiplex", retval );
106 
107  PAPI_get_opt(PAPI_DEF_ITIMER,&itimer);
108 
109  memset(&option,0x0,sizeof(option));
110 
112  option.multiplex.eventset = SoftwareMPX;
113  option.multiplex.ns = itimer.itimer.ns;
114 
115  if ( (retval = PAPI_set_opt( PAPI_MULTIPLEX, &option )) != PAPI_OK )
116  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval);
117 
118  for (i = 0; i < options.min - 1; i++) {
119  if ( options.kernel_mpx ) {
120  if ( ( retval = PAPI_add_event( KernelMPX, Events[i]) ) != PAPI_OK ) {
121  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
122  }
123  }
124 
125  if ( options.force_sw ) {
126  if ( ( retval = PAPI_add_event( SoftwareMPX, Events[i]) ) != PAPI_OK ) {
127  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
128  }
129  }
130  }
131 }
memset(eventId, 0, size)
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1622
static int Events[NUM_EVENTS]
Definition: init_fini.c:8
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:417
return PAPI_OK
Definition: linux-nvml.c:458
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:845
int PAPI_set_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:3409
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int i
Definition: fileop.c:140
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4082
PAPI_multiplex_option_t multiplex
Definition: papi.h:856
#define PAPI_MULTIPLEX
Definition: papi.h:429
int PAPI_assign_eventset_component(int EventSet, int cidx)
Definition: papi.c:1485
#define PAPI_DEF_ITIMER
Definition: papi.h:452
int PAPI_set_multiplex(int EventSet)
Definition: papi.c:3277
ssize_t retval
Definition: libasync.c:338
static options_t options
PAPI_itimer_option_t itimer
Definition: papi.h:857

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 153 of file multiplex_cost.c.

154 {
155  int retval, retval_start, retval_stop;
156  int KernelMPX = PAPI_NULL;
157  int SoftwareMPX = PAPI_NULL;
158  int *Events = NULL;
159  int number_of_counters;
160  int i;
161  int c;
162  int dont_loop_forever;
163  long long totcyc, *values = NULL;
164  long long *array = NULL;
165  int event;
166 
167  PAPI_option_t option, itimer;
168  const PAPI_component_info_t *info;
169 
170  tests_quiet( argc, argv );
171 
173  options.min = 1;
174  options.max = 10;
175  options.force_sw = 1;
176  options.kernel_mpx = 1;
177 
178  while ( ( c=getopt(argc, argv, "hm:x:skt:") ) != -1 ) {
179  switch (c) {
180  case 'h':
181  usage();
182  exit(0);
183  case 'm':
184  options.min = atoi(optarg);
185  break;
186  case 'x':
187  options.max = atoi(optarg);
188  break;
189  case 's':
190  options.force_sw = 0;
191  break;
192  case 'k':
193  options.kernel_mpx = 0;
194  break;
195  case 't':
196  num_iters = atoi(optarg);
197  default:
198  break;
199  }
200  }
201 
202  if ( options.min > options.max ) {
203  test_fail( __FILE__, __LINE__, "Min # of Events > Max # of Events", -1);
204  goto cleanup;
205  }
206 
207  values = (long long*)malloc(sizeof(long long) * options.max);
208  array = (long long *)malloc(sizeof(long long) * 2 * num_iters);
209  Events = ( int* )malloc(sizeof(int) * options.max);
210 
211  if ( ( retval =
213  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
214  if ( ( retval = PAPI_set_debug( PAPI_QUIET ) ) != PAPI_OK )
215  test_fail( __FILE__, __LINE__, "PAPI_set_debug", retval );
216 
217  if ( ( retval = PAPI_multiplex_init( ) ) != PAPI_OK )
218  test_fail( __FILE__, __LINE__, "PAPI_multiplex_init", retval );
219 
220 
221  info = PAPI_get_component_info(0);
223 
224  if ( options.kernel_mpx && !info->kernel_multiplex ) {
225  test_fail( __FILE__, __LINE__, "Kernel multiplexing is not supported on this platform, bailing!\n", PAPI_EINVAL );
226  exit(1);
227  }
228 
229 
230  if ( ( retval = PAPI_create_eventset( &SoftwareMPX ) ) != PAPI_OK )
231  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
232 
233  if ( ( retval = PAPI_create_eventset( &KernelMPX ) ) != PAPI_OK )
234  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
235 
236  if ( ( retval = PAPI_assign_eventset_component( KernelMPX, 0 ) ) != PAPI_OK )
237  test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component", retval);
238 
239  if ( ( retval = PAPI_set_multiplex( KernelMPX ) ) != PAPI_OK )
240  test_fail( __FILE__, __LINE__, "PAPI_set_multiplex", retval );
241 
242  if ( ( retval = PAPI_assign_eventset_component( SoftwareMPX, 0 ) ) != PAPI_OK )
243  test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component", retval);
244 
245  PAPI_get_opt(PAPI_DEF_ITIMER,&itimer);
246 
247  memset(&option,0x0,sizeof(option));
248 
250  option.multiplex.eventset = SoftwareMPX;
251  option.multiplex.ns = itimer.itimer.ns;
252 
253  if ( PAPI_OK != (retval = PAPI_set_opt( PAPI_MULTIPLEX, &option )))
254  test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval);
255 
256  if ( !options.kernel_mpx && !options.force_sw ) {
257  test_fail(__FILE__, __LINE__, "No tests to run.", -1);
258  goto cleanup;
259  } else {
260  fprintf(stderr,"Running test[s]\n");
261  if (options.kernel_mpx)
262  fprintf(stderr,"\tKernel multiplexing read\n");
263  if (options.force_sw)
264  fprintf(stderr,"\tSoftware Multiplexing read\n");
265  }
266 
267  event = 0 | PAPI_NATIVE_MASK;
268  PAPI_enum_event( &event, PAPI_ENUM_FIRST );
269 
270  /* Find some events to run the tests with. */
271  for (number_of_counters = 0; number_of_counters < options.max; number_of_counters++) {
272  dont_loop_forever = 0;
273 
274  if ( options.kernel_mpx ) {
275  do {
277  dont_loop_forever++;
278  } while ( ( retval = PAPI_add_event( KernelMPX, event ) ) != PAPI_OK &&
279  dont_loop_forever < 512);
280  } else {
281  do {
283  dont_loop_forever++;
284  } while ( ( retval = PAPI_add_event( SoftwareMPX, event) ) != PAPI_OK &&
285  dont_loop_forever < 512);
286  }
287  if ( dont_loop_forever == 512 )
288  test_fail( __FILE__, __LINE__, "I can't find %d events to count at once.", options.max);
289 
290  Events[number_of_counters] = event;
291  }
292 
293  PAPI_cleanup_eventset( KernelMPX );
294  PAPI_cleanup_eventset( SoftwareMPX );
295 
296  /* Start/Stop test */
297  init_test(SoftwareMPX, KernelMPX, Events);
298 
299  for (number_of_counters = options.min; number_of_counters < options.max; number_of_counters++) {
300 
301  if ( options.kernel_mpx ) {
302  if ( ( retval = PAPI_add_event( KernelMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
303  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
304  goto cleanup;
305  }
306 
307  if ( ( retval = PAPI_start( KernelMPX ) ) != PAPI_OK )
308  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
309  if ( ( retval = PAPI_stop( KernelMPX, values ) ) != PAPI_OK )
310  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
311 
312  /* KernelMPX Timing loop */
313  for ( i = 0; i < num_iters; i++ ) {
314  totcyc = PAPI_get_real_cyc();
315  retval_start=PAPI_start( KernelMPX );
316  retval_stop=PAPI_stop( KernelMPX, values );
317  array[i] = PAPI_get_real_cyc() - totcyc;
318  if (retval_start || retval_stop)
319  test_fail( __FILE__, __LINE__, "PAPI start/stop", retval_start );
320  } /* End 1 timing run */
321 
322  } else
323  memset(array, 0, sizeof(long long) * num_iters );
324 
325  /* Also test software multiplexing */
326  if ( options.force_sw ) {
327  if ( ( retval = PAPI_add_event( SoftwareMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
328  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
329  goto cleanup;
330  }
331 
332  if ( ( retval = PAPI_start( SoftwareMPX ) ) != PAPI_OK )
333  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
334  if ( ( retval = PAPI_stop( SoftwareMPX, values ) ) != PAPI_OK )
335  test_fail( __FILE__, __LINE__, "PAPI_stop", retval);
336 
337  /* SoftwareMPX Timing Loop */
338  for ( i = num_iters; i < 2*num_iters; i++ ) {
339  totcyc = PAPI_get_real_cyc();
340  retval_start=PAPI_start( SoftwareMPX );
341  retval_stop=PAPI_stop( SoftwareMPX, values );
342  array[i] = PAPI_get_real_cyc() - totcyc;
343  if (retval_start || retval_stop)
344  test_fail( __FILE__, __LINE__, "PAPI start/stop", retval_start );
345  } /* End 2 timing run */
346 
347  } else
348  memset(array+num_iters, 0, sizeof(long long) * num_iters );
349 
350  do_output( "papi_startstop.dat", "Multiplexed PAPI_read()", array, number_of_counters );
351 
352  } /* End counter loop */
353  PAPI_cleanup_eventset( SoftwareMPX );
354  PAPI_cleanup_eventset( KernelMPX );
355  finalize_test();
356 
357  /* PAPI_read() test */
358  init_test(SoftwareMPX, KernelMPX, Events);
359 
360  for (number_of_counters = options.min; number_of_counters < options.max; number_of_counters++) {
361 
362  if ( options.kernel_mpx ) {
363  if ( ( retval = PAPI_add_event( KernelMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
364  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
365  goto cleanup;
366  }
367 
368  if ( ( retval = PAPI_start( KernelMPX ) ) != PAPI_OK )
369  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
370  PAPI_read( KernelMPX, values );
371 
372  /* KernelMPX Timing loop */
373  for ( i = 0; i < num_iters; i++ ) {
374  totcyc = PAPI_get_real_cyc();
375  retval = PAPI_read( KernelMPX, values );
376  array[i] = PAPI_get_real_cyc() - totcyc;
377  } /* End 1 timing run */
378 
379  retval_stop=PAPI_stop( KernelMPX, values );
380  if (retval_stop!=PAPI_OK)
381  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
382  } else
383  memset(array, 0, sizeof(long long) * num_iters );
384 
385  /* Also test software multiplexing */
386  if ( options.force_sw ) {
387  if ( ( retval = PAPI_add_event( SoftwareMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
388  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
389  goto cleanup;
390  }
391 
392  if ( ( retval = PAPI_start( SoftwareMPX ) ) != PAPI_OK )
393  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
394  PAPI_read( SoftwareMPX, values );
395 
396  /* SoftwareMPX Timing Loop */
397  for ( i = num_iters; i < 2*num_iters; i++ ) {
398  totcyc = PAPI_get_real_cyc();
399  retval = PAPI_read( SoftwareMPX, values );
400  array[i] = PAPI_get_real_cyc() - totcyc;
401  } /* End 2 timing run */
402 
403  retval_stop=PAPI_stop( SoftwareMPX, values );
404  if (retval_stop!=PAPI_OK)
405  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
406  } else
407  memset(array+num_iters, 0, sizeof(long long) * num_iters );
408 
409  do_output( "papi_read.dat", "Multiplexed PAPI_read()", array, number_of_counters );
410 
411  } /* End counter loop */
412  PAPI_cleanup_eventset( SoftwareMPX );
413  PAPI_cleanup_eventset( KernelMPX );
414  finalize_test();
415 
416 
417 
418  /* PAPI_read_ts() test */
419  init_test( SoftwareMPX, KernelMPX, Events);
420 
421  for (number_of_counters = options.min; number_of_counters < options.max; number_of_counters++) {
422 
423  if ( options.kernel_mpx ) {
424  if ( (retval = PAPI_add_event( KernelMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
425  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
426  goto cleanup;
427  }
428 
429  if ( ( retval = PAPI_start( KernelMPX ) ) != PAPI_OK )
430  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
431  PAPI_read_ts( KernelMPX, values, &totcyc );
432 
433  /* KernelMPX Timing loop */
434  for ( i = 0; i < num_iters; i++ ) {
435  retval = PAPI_read_ts( KernelMPX, values, &array[i] );
436  } /* End 1 timing run */
437 
438  /* post-process the timing array */
439  for ( i = num_iters - 1; i > 0; i-- ) {
440  array[i] -= array[i - 1];
441  }
442  array[0] -= totcyc;
443 
444  retval_stop=PAPI_stop( KernelMPX, values );
445  if (retval_stop!=PAPI_OK)
446  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
447  } else
448  memset(array, 0, sizeof(long long) * num_iters );
449 
450  /* Also test software multiplexing */
451  if ( options.force_sw ) {
452  if ( ( retval = PAPI_add_event( SoftwareMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
453  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
454  goto cleanup;
455  }
456 
457  if ( ( retval = PAPI_start( SoftwareMPX ) ) != PAPI_OK )
458  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
459  PAPI_read_ts( SoftwareMPX, values, &totcyc);
460 
461  /* SoftwareMPX Timing Loop */
462  for ( i = num_iters; i < 2*num_iters; i++ ) {
463  retval = PAPI_read_ts( SoftwareMPX, values, &array[i]);
464  } /* End 2 timing run */
465 
466  retval_stop=PAPI_stop( SoftwareMPX, values );
467  if (retval_stop!=PAPI_OK)
468  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
469 
470  /* post-process the timing array */
471  for ( i = 2*num_iters - 1; i > num_iters; i-- ) {
472  array[i] -= array[i - 1];
473  }
474  array[num_iters] -= totcyc;
475 
476  } else
477  memset(array+num_iters, 0, sizeof(long long) * num_iters );
478 
479  do_output( "papi_read_ts.dat", "Multiplexed PAPI_read_ts()", array, number_of_counters );
480 
481  } /* End counter loop */
482  PAPI_cleanup_eventset( SoftwareMPX );
483  PAPI_cleanup_eventset( KernelMPX );
484  finalize_test();
485 
486 
487  /* PAPI_accum() test */
488  init_test(SoftwareMPX, KernelMPX, Events);
489 
490  for (number_of_counters = options.min; number_of_counters < options.max; number_of_counters++) {
491 
492  if ( options.kernel_mpx ) {
493  if ( ( retval = PAPI_add_event( KernelMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
494  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
495  goto cleanup;
496  }
497 
498  if ( ( retval = PAPI_start( KernelMPX ) ) != PAPI_OK )
499  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
500  PAPI_read( KernelMPX, values );
501 
502  /* KernelMPX Timing loop */
503  for ( i = 0; i < num_iters; i++ ) {
504  totcyc = PAPI_get_real_cyc();
505  retval = PAPI_accum( KernelMPX, values );
506  array[i] = PAPI_get_real_cyc() - totcyc;
507  } /* End 1 timing run */
508 
509  retval_stop=PAPI_stop( KernelMPX, values );
510  if (retval_stop!=PAPI_OK)
511  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
512  } else
513  memset(array, 0, sizeof(long long) * num_iters );
514 
515  /* Also test software multiplexing */
516  if ( options.force_sw ) {
517  if ( ( retval = PAPI_add_event( SoftwareMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
518  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
519  goto cleanup;
520  }
521 
522  if ( ( retval = PAPI_start( SoftwareMPX ) ) != PAPI_OK )
523  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
524  PAPI_read( SoftwareMPX, values );
525 
526  /* SoftwareMPX Timing Loop */
527  for ( i = num_iters; i < 2*num_iters; i++ ) {
528  totcyc = PAPI_get_real_cyc();
529  retval = PAPI_accum( SoftwareMPX, values );
530  array[i] = PAPI_get_real_cyc() - totcyc;
531  } /* End 2 timing run */
532 
533  retval_stop=PAPI_stop( SoftwareMPX, values );
534  if (retval_stop!=PAPI_OK)
535  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
536  } else
537  memset(array+num_iters, 0, sizeof(long long) * num_iters );
538 
539  do_output( "papi_accum.dat", "Multiplexed PAPI_accum()", array, number_of_counters );
540 
541  } /* End counter loop */
542  PAPI_cleanup_eventset( SoftwareMPX );
543  PAPI_cleanup_eventset( KernelMPX );
544  finalize_test();
545 
546  /* PAPI_reset() test */
547  init_test(SoftwareMPX, KernelMPX, Events);
548 
549  for (number_of_counters = options.min; number_of_counters < options.max; number_of_counters++) {
550 
551  if ( options.kernel_mpx ) {
552  if ( ( retval = PAPI_add_event( KernelMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
553  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
554  goto cleanup;
555  }
556 
557  if ( ( retval = PAPI_start( KernelMPX ) ) != PAPI_OK )
558  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
559  PAPI_read( KernelMPX, values );
560 
561  /* KernelMPX Timing loop */
562  for ( i = 0; i < num_iters; i++ ) {
563  totcyc = PAPI_get_real_cyc();
564  retval = PAPI_reset( KernelMPX );
565  array[i] = PAPI_get_real_cyc() - totcyc;
566  } /* End 1 timing run */
567 
568  retval_stop=PAPI_stop( KernelMPX, values );
569  if (retval_stop!=PAPI_OK)
570  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
571  } else
572  memset(array, 0, sizeof(long long) * num_iters );
573 
574  /* Also test software multiplexing */
575  if ( options.force_sw ) {
576  if ( ( retval = PAPI_add_event( SoftwareMPX, Events[number_of_counters - options.min] ) ) != PAPI_OK ) {
577  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval);
578  goto cleanup;
579  }
580 
581  if ( ( retval = PAPI_start( SoftwareMPX ) ) != PAPI_OK )
582  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
583  PAPI_read( SoftwareMPX, values );
584 
585  /* SoftwareMPX Timing Loop */
586  for ( i = num_iters; i < 2*num_iters; i++ ) {
587  totcyc = PAPI_get_real_cyc();
588  retval = PAPI_reset( SoftwareMPX );
589  array[i] = PAPI_get_real_cyc() - totcyc;
590  } /* End 2 timing run */
591 
592  retval_stop=PAPI_stop( SoftwareMPX, values );
593  if (retval_stop!=PAPI_OK)
594  test_fail( __FILE__, __LINE__, "PAPI_stop", retval_stop );
595  } else
596  memset(array+num_iters, 0, sizeof(long long) * num_iters );
597 
598  do_output( "papi_reset.dat", "Multiplexed PAPI_reset()", array, number_of_counters );
599 
600  } /* End counter loop */
601  PAPI_cleanup_eventset( SoftwareMPX );
602  PAPI_cleanup_eventset( KernelMPX );
603  finalize_test();
604 
605 
606  test_pass( __FILE__, NULL, 0 );
607 cleanup:
608  if ( KernelMPX != PAPI_NULL)
609  PAPI_cleanup_eventset( KernelMPX );
610  if ( SoftwareMPX != PAPI_NULL )
611  PAPI_cleanup_eventset( KernelMPX );
612 
613  if ( values != NULL )
614  free(values);
615  if ( array != NULL )
616  free(array);
617  if ( Events != NULL )
618  free(Events);
619 
620  PAPI_shutdown();
621  exit( 1 );
622 }
int atoi()
memset(eventId, 0, size)
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2258
#define PAPI_NATIVE_MASK
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:807
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1622
int PAPI_reset(int EventSet)
Definition: papi.c:2403
static int Events[NUM_EVENTS]
Definition: init_fini.c:8
volatile int num_iters
#define PAPI_NULL
Definition: papi.h:290
int PAPI_enum_event(int *EventCode, int modifier)
Definition: papi.c:1150
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
#define PAPI_MULTIPLEX_FORCE_SW
Definition: papi.h:417
return PAPI_OK
Definition: linux-nvml.c:458
void finalize_test(void)
tests_quiet(argc, argv)
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:845
return PAPI_EINVAL
Definition: linux-nvml.c:408
double c
Definition: multiplex.c:22
test_pass(__FILE__, NULL, 0)
int PAPI_set_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:3409
int int argc
Definition: iozone.c:1609
char ** argv
Definition: iozone.c:1610
int PAPI_accum(int EventSet, long long *values)
Definition: papi.c:2689
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:497
int i
Definition: fileop.c:140
void PAPI_shutdown(void)
Definition: papi.c:4400
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4082
free(dummyfile[xx])
void usage(void)
Definition: fileop.c:1330
unsigned int kernel_multiplex
Definition: papi.h:653
PAPI_multiplex_option_t multiplex
Definition: papi.h:856
#define PAPI_MULTIPLEX
Definition: papi.h:429
int PAPI_cleanup_eventset(int EventSet)
Definition: papi.c:2834
int PAPI_assign_eventset_component(int EventSet, int cidx)
Definition: papi.c:1485
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1424
int PAPI_multiplex_init(void)
Definition: papi.c:2926
void init_test(int SoftwareMPX, int KernelMPX, int *Events)
int PAPI_read_ts(int EventSet, long long *values, long long *cycles)
Definition: papi.c:2592
void do_output(char *fn, char *message, long long *array, int noc)
#define PAPI_DEF_ITIMER
Definition: papi.h:452
#define PAPI_QUIET
Definition: papi.h:386
int PAPI_set_multiplex(int EventSet)
Definition: papi.c:3277
long long PAPI_get_real_cyc(void)
Definition: papi.c:6143
int PAPI_read(int EventSet, long long *values)
Definition: papi.c:2503
int PAPI_start(int EventSet)
Definition: papi.c:2053
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:223
static options_t options
void exit()
PAPI_itimer_option_t itimer
Definition: papi.h:857
int PAPI_set_debug(int level)
Definition: papi.c:3070
char * optarg

Here is the call graph for this function:

static void usage ( void  )
static

Definition at line 142 of file multiplex_cost.c.

143 {
144  printf( "Usage: papi_multiplex_cost [options]\n\
145 \t-m num, number of events to count\n\
146 \t-x num, number of events to count\n\
147 \t-s, Do not run software multiplexing test.\n\
148 \t-k, Do not attempt kernel multiplexed test.\n\
149 \t-t THREASHOLD set the threshold for the number of iterations. Default: 100,000\n" );
150 }
#define printf
Definition: papi_test.h:125

Variable Documentation

int first_time = 1
static

Definition at line 46 of file multiplex_cost.c.

FILE* fp
static

Definition at line 48 of file multiplex_cost.c.

options_t options
static

Definition at line 58 of file multiplex_cost.c.

int skip = 0
static

Definition at line 47 of file multiplex_cost.c.