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

Go to the source code of this file.

Data Structures

struct  list_t
 

Macros

#define CONSTANT_DELIM   "#define"
 
#define SHOW_LOADS
 

Functions

void PRINT_UE (user_defined_event_t *ue)
 
void _papi_cleanup_user_events ()
 
void append_to_global_list (user_defined_event_t *more)
 
int is_operation (char *op)
 
static char * trim_string (char *in)
 
static char * trim_note (char *in)
 
static int get_event_line (char **place, FILE *table, char **tmp_perfmon_events_table)
 
int add_define (char *line, list_t *LIST)
 
int renumber_ops_string (char *dest, char *src, int start)
 
int is_define (char *t, list_t *next, char *ops)
 
int check_native_events (char *target, user_defined_event_t *ue, int *msi)
 
int check_preset_events (char *target, user_defined_event_t *ue, int *msi)
 
int check_user_events (char *target, user_defined_event_t *ue, int *msi, user_defined_event_t *search, int search_size)
 
static int load_user_event_table (char *file_name)
 
int _papi_user_defined_events_setup (char *name)
 

Variables

unsigned int PAPI_NATIVE_EVENT_SHIFT
 
unsigned int PAPI_NATIVE_UMASK_SHIFT
 
user_defined_event_t_papi_user_events = NULL
 
unsigned int _papi_user_events_count = 0
 
list_t defines
 
int first_time = 1
 

Detailed Description

Author
James Ralph ralph.nosp@m.@eec.nosp@m.s.utk.nosp@m..edu

Definition in file papi_user_events.c.

Macro Definition Documentation

#define CONSTANT_DELIM   "#define"

Definition at line 34 of file papi_user_events.c.

#define SHOW_LOADS

Definition at line 36 of file papi_user_events.c.

Function Documentation

void _papi_cleanup_user_events ( )

Definition at line 66 of file papi_user_events.c.

67 {
68  unsigned int i;
70  list_t *a,*b;
71 
72  for ( i = 0; i < _papi_user_events_count; i++ ) {
73  t = _papi_user_events + i;
74 
75  if ( t->short_desc != NULL )
76  free(t->short_desc);
77  if ( t->long_desc != NULL )
78  free(t->long_desc);
79 
80  }
81 
82  if ( _papi_user_events != NULL )
84 
85  _papi_user_events = NULL;
86  _papi_user_events_count = 0;
87 
88  /* cleanup the defines list too */
89  for ( a = defines.next; a != NULL; ) {
90  b=a->next;
91  papi_free(a);
92  a = b;
93  }
94 }
list_t defines
#define papi_free(a)
Definition: papi_memory.h:35
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
t
Definition: iozone.c:23562
int i
Definition: fileop.c:140
free(dummyfile[xx])
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
struct def_list * next
user_defined_event_t * _papi_user_events
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_user_defined_events_setup ( char *  name)

Definition at line 705 of file papi_user_events.c.

706 {
707  int retval;
708 
709  if ( first_time ) {
711  defines.next = NULL;
712  }
713 
714  retval = load_user_event_table( name );
715 
716  if (retval < 0)
717  return( retval );
718 
719  first_time = 0;
720  return( PAPI_OK );
721 }
static int load_user_event_table(char *file_name)
list_t defines
return PAPI_OK
Definition: linux-nvml.c:458
int first_time
struct def_list * next
char * name
Definition: iozone.c:23648
ssize_t retval
Definition: libasync.c:338
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int add_define ( char *  line,
list_t LIST 
)

Definition at line 247 of file papi_user_events.c.

247  {
248  char *t;
249  char local_line[USER_EVENT_OPERATION_LEN];
250  list_t *temp;
251 
252  strncpy( local_line, line, USER_EVENT_OPERATION_LEN );
253 
254  temp = (list_t*)papi_malloc(sizeof(list_t));
255 
256  if ( NULL == temp ) {
257  PAPIERROR("outof memory" );
258  return PAPI_ENOMEM;
259  }
260 
261  strtok(local_line, " "); /* throw out the #define */
262 
263  /* next token should be the name */
264  t = strtok(NULL, " ");
265  strncpy( temp->name, t, PAPI_MIN_STR_LEN);
266 
267  /* next token should be the value */
268  t = strtok(NULL," ");
269  t[strlen(t)] = '\0';
270  strncpy( temp->value, t, PAPI_MIN_STR_LEN);
271 
272  temp->next = LIST->next;
273  LIST->next = temp;
274 
275  return PAPI_OK;
276 }
char value[PAPI_MIN_STR_LEN]
#define PAPI_ENOMEM
Definition: fpapi.h:107
#define papi_malloc(a)
Definition: papi_memory.h:34
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
return PAPI_OK
Definition: linux-nvml.c:458
char name[PAPI_MIN_STR_LEN]
t
Definition: iozone.c:23562
#define USER_EVENT_OPERATION_LEN
void PAPIERROR(char *format,...)
struct def_list * next
int temp
Definition: iozone.c:22158

Here is the call graph for this function:

Here is the caller graph for this function:

void append_to_global_list ( user_defined_event_t more)

Definition at line 97 of file papi_user_events.c.

98 {
100 
102  if (new == NULL) {
103  PAPIERROR("Unable to allocate %d bytes of memory.\n", sizeof(user_defined_event_t)*(1+_papi_user_events_count));
104  } else {
105  if (_papi_user_events != NULL) {
108  }
109 
110  memcpy( new + _papi_user_events_count, more, sizeof(user_defined_event_t) );
111 
112  _papi_user_events = new;
114  }
115 }
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
void PAPIERROR(char *format,...)
user_defined_event_t * _papi_user_events
unsigned int _papi_user_events_count

Here is the call graph for this function:

Here is the caller graph for this function:

int check_native_events ( char *  target,
user_defined_event_t ue,
int msi 
)

Definition at line 325 of file papi_user_events.c.

326 {
327  char temp[PAPI_MIN_STR_LEN];
328  int found = 0;
329  int ret;
330  int magic_string_int = *msi;
331  int len = 0;
332 
333  if ( ( ret = _papi_hwi_native_name_to_code( target, &ue->events[ue->count] ) ) == PAPI_OK ) {
334  if ( ue->events[ue->count] == 0 ) {
335  INTDBG( "Event %s not found!\n", target);
336  } else {
337  found = 1;
338  sprintf(temp, "N%d|", magic_string_int++);
339  len = strlen(ue->operation) + strlen(temp);
340  ue->count++;
341 #ifdef SHOW_LOADS
342  INTDBG("\tFound a native event %s\n", target);
343 #endif
344  if ( len >= USER_EVENT_OPERATION_LEN ) {
345  fprintf(stderr,"outa room");
346  return -1;
347  }
348  strcat(ue->operation, temp);
349  *msi = magic_string_int;
350  }
351  }
352 
353  return found;
354 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
return PAPI_OK
Definition: linux-nvml.c:458
int _papi_hwi_native_name_to_code(char *in, int *out)
#define INTDBG(format, args...)
Definition: papi_debug.h:65
long long ret
Definition: iozone.c:1346
long long found
Definition: libasync.c:735
#define USER_EVENT_OPERATION_LEN
strcat(command, mountname)
char operation[USER_EVENT_OPERATION_LEN]
int temp
Definition: iozone.c:22158

Here is the call graph for this function:

Here is the caller graph for this function:

int check_preset_events ( char *  target,
user_defined_event_t ue,
int msi 
)

Definition at line 357 of file papi_user_events.c.

358 {
359  char op;
360  int j = 0;
361  int k;
362  int found = 0;
363  int magic_string_int = *msi;
364 
365  char temp[PAPI_MIN_STR_LEN];
366 
367  /* XXX make sure that we don't overflow the ue->operation buffer */
368  int length = PAPI_MIN_STR_LEN;
369 
370  memset(temp, 0, PAPI_MIN_STR_LEN);
371  for ( j = 0; ( j < PAPI_MAX_PRESET_EVENTS) && (_papi_hwi_presets[j].symbol != NULL ); j++ ) {
372  if ( strcasecmp( target, _papi_hwi_presets[j].symbol ) == 0) {
373 #ifdef SHOW_LOADS
374  INTDBG("\tFound a match for preset event %s\n", _papi_hwi_presets[j].symbol);
375 #endif
376  /* Check that the preset event we're trying to add is actually available on this system */
377  if ( _papi_hwi_presets[j].count == 0 ) {
378  PAPIERROR("NEXTLINE:\t%s is not available on this platform. Skipping event %s\n",
379  target, ue->symbol);
380  /* clean up this and ditch this whole line */
381  memset(ue, 0, sizeof(user_defined_event_t));
382  return -1;
383  }
384 
385  length = strlen(ue->operation);
386 
387  /* Deal with singleton events */
388  if (!_papi_hwi_presets[j].derived_int) {
389  sprintf(temp, "N%d|", magic_string_int++);
390  length = strlen(ue->operation) + strlen(temp);
391  if ( length >= USER_EVENT_OPERATION_LEN ) {
392  fprintf(stderr,"Out of room, the user defined event %s is too large!\n", ue->symbol );
393  return -1;
394  }
395  strcat(ue->operation, temp);
396  ue->events[ue->count++] = _papi_hwi_presets[j].code[0];
397  } else {
398  op = '-';
399  switch ( _papi_hwi_presets[j].derived_int ) {
400  case DERIVED_ADD:
401  case DERIVED_ADD_PS:
402  op = '+';
403  case DERIVED_SUB:
404  for ( k = 0; k < (int) _papi_hwi_presets[j].count; k++) {
405  ue->events[ue->count++] = _papi_hwi_presets[j].code[k];
406  if (k%2)
407  sprintf(temp, "N%d|%c|", magic_string_int++, op);
408  else
409  sprintf(temp, "N%d|", magic_string_int++);
410 
411  length = strlen(ue->operation) + strlen(temp);
412  if ( USER_EVENT_OPERATION_LEN <= length ) {
413  PAPIERROR("The user defined event %s has to may operands in its definition.\n", ue->symbol );
414  return -1;
415  }
416  strcat(ue->operation, temp);
417  }
418  break;
419 
420  case DERIVED_POSTFIX:
421  for ( k = 0; k < (int)_papi_hwi_presets[j].count; k++ ) {
422  ue->events[ue->count++] = _papi_hwi_presets[j].code[k];
423  }
424  /* so we need to go through the ops string and renumber the N's
425  as we place it in our ue ops string */
426  magic_string_int = renumber_ops_string(temp,
427  _papi_hwi_presets[j].postfix, magic_string_int);
428  length = strlen( temp ) + strlen( ue->operation );
429  if ( length >= USER_EVENT_OPERATION_LEN ) {
430  PAPIERROR( "User Event %s's expression is too long.", ue->symbol );
431  return -1;
432  }
433  strcat(ue->operation, temp);
434  default:
435  break;
436  } /* /switch */
437  } /* /derived */
438  found = 1;
439  break;
440  } /* /symbol match */
441 
442  } /* end while(preset events) */
443 
444  *msi = magic_string_int;
445  return found;
446 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
#define DERIVED_SUB
Definition: papi_internal.h:74
unsigned long long length
Definition: iozone.c:17106
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
int count
Definition: iozone.c:22422
#define DERIVED_ADD
Definition: papi_internal.h:70
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int renumber_ops_string(char *dest, char *src, int start)
long long found
Definition: libasync.c:735
#define USER_EVENT_OPERATION_LEN
int k
Definition: iozone.c:19136
hwi_presets_t _papi_hwi_presets[PAPI_MAX_PRESET_EVENTS]
char symbol[PAPI_MIN_STR_LEN]
void PAPIERROR(char *format,...)
strcat(command, mountname)
#define PAPI_MAX_PRESET_EVENTS
Definition: fpapi.h:16
char operation[USER_EVENT_OPERATION_LEN]
int
Definition: iozone.c:18528
int temp
Definition: iozone.c:22158
unsigned int code[PAPI_MAX_INFO_TERMS]
Definition: papi_preset.h:32
#define DERIVED_ADD_PS
Definition: papi_internal.h:72
long j
Definition: iozone.c:19135
#define DERIVED_POSTFIX
Definition: papi_internal.h:75
int int op
Definition: iozone.c:19389

Here is the call graph for this function:

Here is the caller graph for this function:

int check_user_events ( char *  target,
user_defined_event_t ue,
int msi,
user_defined_event_t search,
int  search_size 
)

Definition at line 449 of file papi_user_events.c.

450 {
451  char temp[PAPI_MIN_STR_LEN];
452  int j = 0;
453  int k = 0;
454  int found = 0;
455  int magic_string_int = *msi;
456  int len = 0;
457 
458  memset(temp, 0, PAPI_MIN_STR_LEN);
459  for (j=0; j < search_size; j++) {
460  if ( strcasecmp( target, search[j].symbol) == 0 ) {
461 #ifdef SHOW_LOADS
462  INTDBG("\tFount a match for user event %s at search[%d]\n", search[j].symbol, j );
463 #endif
464 
465  for ( k = 0; k < (int)search[j].count; k++ ) {
466  ue->events[ue->count++] = search[j].events[k];
467  }
468 
469  /* so we need to go through the ops string and renumber the N's
470  as we place it in our ue ops string */
471  magic_string_int = renumber_ops_string(temp,
472  search[j].operation, magic_string_int);
473 
474  len = strlen( temp ) + strlen( ue->operation );
475  if ( len >= USER_EVENT_OPERATION_LEN ) {
476  PAPIERROR( "User Event %s is trying to use an invalid expression, its too long.", ue->symbol );
477  return -1;
478  }
479  strcat(ue->operation, temp);
480  found = 1;
481  }
482  }
483 
484  *msi = magic_string_int;
485  return found;
486 }
memset(eventId, 0, size)
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
int events[PAPI_EVENTS_IN_DERIVED_EVENT]
int count
Definition: iozone.c:22422
#define INTDBG(format, args...)
Definition: papi_debug.h:65
int renumber_ops_string(char *dest, char *src, int start)
long long found
Definition: libasync.c:735
#define USER_EVENT_OPERATION_LEN
int k
Definition: iozone.c:19136
char symbol[PAPI_MIN_STR_LEN]
void PAPIERROR(char *format,...)
strcat(command, mountname)
char operation[USER_EVENT_OPERATION_LEN]
int
Definition: iozone.c:18528
int temp
Definition: iozone.c:22158
long j
Definition: iozone.c:19135

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_event_line ( char **  place,
FILE *  table,
char **  tmp_perfmon_events_table 
)
static

Definition at line 206 of file papi_user_events.c.

207 {
208  int ret = 0;
209  int i;
210  char *line = place[0];
211  int c = 0;
212 
213  if ( table ) {
214  if ( fgets( place[0], USER_EVENT_OPERATION_LEN, table ) ) {
215 
216  i = strlen( place[0] );
217  c = place[0][i-1];
218  /* throw away the rest of the line. */
219  while ( c != '\n' && c != EOF )
220  c = fgetc( table );
221 
222  ret = i;
223  line = place[0];
224 
225  for ( i = 0; i < (int)strlen( place[0] ); i++ )
226  if ( place[0][i] == '\n' )
227  place[0][i] = 0;
228  } else
229  ret = 0;
230  } else {
231  for ( i = 0;
232  **tmp_perfmon_events_table && **tmp_perfmon_events_table != '\n' &&
234  i++ ) {
235  line[i] = **tmp_perfmon_events_table;
236  ( *tmp_perfmon_events_table )++;
237  }
238  if ( **tmp_perfmon_events_table == '\n' ) {
239  ( *tmp_perfmon_events_table )++;
240  }
241  line[i] = '\0';
242  ret = **tmp_perfmon_events_table;
243  }
244  return ( ret );
245 }
double c
Definition: multiplex.c:22
long long ret
Definition: iozone.c:1346
int i
Definition: fileop.c:140
#define USER_EVENT_OPERATION_LEN
int
Definition: iozone.c:18528

Here is the caller graph for this function:

int is_define ( char *  t,
list_t next,
char *  ops 
)

Definition at line 300 of file papi_user_events.c.

300  {
301  int found = 0;
302  char temp[PAPI_MIN_STR_LEN];
303  int len = 0;
304 
305  /* check if its a predefined constant */
306  while( next != (void*) NULL ) {
307  if ( ! strcmp(t, next->name) ) {
308  sprintf(temp,"%s|", next->value);
309  len = strlen(ops) + strlen(temp);
310  if ( len >= USER_EVENT_OPERATION_LEN ) {
311  fprintf(stderr,"outa room");
312  return -1;
313  }
314 
315  strcat(ops,temp);
316  found = 1;
317  break;
318  }
319  next = next->next;
320  }
321  return (found);
322 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
char value[PAPI_MIN_STR_LEN]
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
char name[PAPI_MIN_STR_LEN]
t
Definition: iozone.c:23562
long long found
Definition: libasync.c:735
#define USER_EVENT_OPERATION_LEN
strcat(command, mountname)
struct def_list * next
int temp
Definition: iozone.c:22158

Here is the call graph for this function:

Here is the caller graph for this function:

int is_operation ( char *  op)

Definition at line 118 of file papi_user_events.c.

119 {
120  char first = op[0];
121 
122  switch(first) {
123  case '+':
124  case '-':
125  case '*':
126  case '/':
127  case '%':
128  return 1;
129  default:
130  return 0;
131  }
132 }
int int op
Definition: iozone.c:19389

Here is the caller graph for this function:

static int load_user_event_table ( char *  file_name)
static

Definition at line 506 of file papi_user_events.c.

507 {
508  char *line;
509  char temp[PAPI_MIN_STR_LEN];
510  char *t;
511  char **ptr = NULL;
512  int insert = 0;
513  int size = 0;
514  int tokens = 0;
515  int found = 0;
516  int oops;
517  int len = 0;
518  int magic_string_int;
519  FILE* table = NULL;
521 
522 
523  if ( file_name == NULL ) {
524 #ifndef STATIC_USER_EVENTS
525  PAPIERROR( "Cowardly refusing to load events file NULL\n" );
526  return ( PAPI_EBUG );
527 #else
528  /* Only parse the static events once! */
529  if ( !first_time ) {
530  PAPIERROR("Cowardly refusing to load events file NULL\n" );
531  return ( PAPI_EBUG );
532  }
533 
534  INTDBG("Loading events from papi_static_user_events.h\n");
535  ptr = &user_events_table;
536  table = NULL;
537 
538 #endif
539  } else {
540  table = fopen(file_name, "r");
541 
542  if ( !table ) {
543  PAPIERROR( "The user events file '%s' does not exist; bailing!", file_name );
544  return ( PAPI_EBUG );
545  }
546 
547  }
548 
549  line = (char*) papi_malloc( USER_EVENT_OPERATION_LEN + 1 );
550  /* Main parse loop */
551  while (get_event_line(&line, table, ptr) > 0 ) {
552  magic_string_int = 0;
553  len = 0;
554 
555  t = trim_string( strtok(line, ","));
556  if ( (t==NULL) || (strlen(t) == 0) )
557  continue;
558 
560  memset( foo, 0x0, sizeof(user_defined_event_t) );
561 
562  /* Deal with comments and constants */
563  if (t[0] == '#') {
564  if ( 0 == strncmp("define",t+1,6) ) {
565  papi_free(foo);
566  if ( PAPI_OK != (oops = add_define( t , &defines ) ) ) {
567  papi_free(line);
568  if (table)
569  fclose(table);
570  return oops;
571  }
572  continue;
573  }
574  goto nextline;
575  }
576 
577  strncpy(foo->symbol, t, PAPI_MIN_STR_LEN);
578 #ifdef SHOW_LOADS
579  INTDBG("Found a user event named %s\n", foo->symbol );
580 #endif
581  /* This segment handles the postfix operation string
582  * converting it from OPERAND1|OPERAND2|+
583  * to the papi internal N1|N2|+ : OPERAND1:OPERAND2
584  * with some basic sanity checking of the operands */
585 
586  do {
587  memset(temp, 0, sizeof(temp));
588  found = 0;
589  t = trim_string(strtok(NULL, "|"));
590  if ( (t==NULL) || (strlen(t) == 0) )
591  break;
592 
593  if ( is_operation(t) ) {
594 #ifdef SHOW_LOADS
595  INTDBG("\tFound operation %c\n", t[0]);
596 #endif
597  sprintf(temp, "%c|", t[0]);
598  len = strlen(foo->operation) + strlen(temp);
599  if ( len >= USER_EVENT_OPERATION_LEN ) {
600  PAPIERROR("User Event %s's expression is too long.", foo->symbol );
601  goto nextline;
602  }
603  strcat(foo->operation, temp);
604  tokens--;
605  } else if ( isdigit(t[0]) ) {
606  /* its a number, the read time parser handlers those */
607  sprintf(temp,"%s|", t);
608  len = strlen( foo->operation ) + strlen( temp );
609  if ( len >= USER_EVENT_OPERATION_LEN ) {
610  PAPIERROR("Invalid event specification %s's expression is too long.", foo->symbol);
611  goto nextline;
612  }
613  strcat(foo->operation, temp);
614  tokens++;
615 #ifdef SHOW_LOADS
616  INTDBG("\tFound number %s\n", t);
617 #endif
618  } else if (is_define(t, defines.next, foo->operation)) {
619  tokens++;
620 #ifdef SHOW_LOADS
621  INTDBG("\tFound a predefined thing %s\n", t);
622 #endif
623  } else {
624  /* check if its a native event */
625  if ( check_native_events(t, foo, &magic_string_int) ) {
626  found = 1;
627  }
628 
629  /* so its not a native event, is it a preset? */
630  if ( !found ) {
631  found = check_preset_events(t, foo, &magic_string_int);
632  } /* end preset check */
633 
634  /* its not native nor preset is it a UE that we've already seen? */
635  /* look through _papi_user_events */
636  if ( !found ) {
637  found = check_user_events(t, foo, &magic_string_int,
639  }
640 
641  /* and the current array of parsed events from this file */
642  if ( !found ) {
643  if (insert > 0)
644  found = check_user_events(t, foo, &magic_string_int, foo, insert);
645  }
646 
647  if ( !found ) {
648  INTDBG("HELP!!! UNABLE TO FIND SYMBOL %s\n", t);
649  PAPIERROR("NEXTLIN:\tSymbol lookup failure, I have no clue what %s is, perhaps you have a bad ops string?\n", t);
650  goto nextline;
651  } else {
652  tokens++;
653  }
654  } /* END native, preset, user defined event lookups */
655 
656  } while( (int)foo->count < _papi_hwd[0]->cmp_info.num_mpx_cntrs );
657 
658  if ( _papi_hwd[0]->cmp_info.num_mpx_cntrs - (int)foo->count < tokens ) {
659  INTDBG("Event %s is attempting to use too many terms in its expression.\n", foo->symbol );
660  goto nextline;
661  }
662 
663  /* refine what we mean here, if we exaust the number of counters, do we still allow constants */
664  while ( tokens > 1 ) {
665  t = trim_string(strtok(NULL, "|"));
666  if ( t == NULL ) {
667  INTDBG("INVALID event specification (%s)\n", foo->symbol);
668  goto nextline;
669  }
670  if ( is_operation(t) ) {
671  sprintf(temp,"%c|", t[0]);
672  /* TODO */
673  len = strlen(temp) + strlen(foo->operation);
674  if ( len >= USER_EVENT_OPERATION_LEN ) {
675  PAPIERROR("User Event %s contains too many operations.", foo->symbol );
676  goto nextline;
677  }
678  strcat(foo->operation, temp);
679  tokens--;
680  } else {
681  PAPIERROR("INVALID event specification, %s is attempting to use too many events\n", foo->symbol);
682  goto nextline;
683  }
684  }
685 
686  append_to_global_list( foo );
687 #ifdef SHOW_LOADS
688  PRINT_UE(foo);
689 #endif
690 
691  insert++;
692  size++;
693 nextline:
694  tokens = 0;
695  papi_free(foo);
696  } /* End main parse loop */
697  if (table)
698  fclose(table);
699 
700  papi_free(line);
701  return insert;
702 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
list_t defines
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
int check_preset_events(char *target, user_defined_event_t *ue, int *msi)
static char * trim_string(char *in)
return PAPI_OK
Definition: linux-nvml.c:458
void append_to_global_list(user_defined_event_t *more)
fclose(thread_wqfd)
static int get_event_line(char **place, FILE *table, char **tmp_perfmon_events_table)
#define INTDBG(format, args...)
Definition: papi_debug.h:65
void PRINT_UE(user_defined_event_t *ue)
t
Definition: iozone.c:23562
long long found
Definition: libasync.c:735
char *long long size
Definition: iozone.c:12023
#define USER_EVENT_OPERATION_LEN
int first_time
pthread_attr_t foo
Definition: iozone.c:18592
int is_define(char *t, list_t *next, char *ops)
int check_native_events(char *target, user_defined_event_t *ue, int *msi)
int is_operation(char *op)
int add_define(char *line, list_t *LIST)
char symbol[PAPI_MIN_STR_LEN]
void PAPIERROR(char *format,...)
strcat(command, mountname)
int tokens
Definition: iozone.c:19606
struct def_list * next
#define PAPI_EBUG
Definition: fpapi.h:111
char operation[USER_EVENT_OPERATION_LEN]
int temp
Definition: iozone.c:22158
struct papi_vectors * _papi_hwd[]
user_defined_event_t * _papi_user_events
int check_user_events(char *target, user_defined_event_t *ue, int *msi, user_defined_event_t *search, int search_size)
unsigned int _papi_user_events_count
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

void PRINT_UE ( user_defined_event_t ue)

Definition at line 54 of file papi_user_events.c.

55 {
56 #ifndef DEBUG
57  (void)ue; /* clean up unused parameter warning if debugging messages are not used */
58 #endif
59  INTDBG("User Event debug\n");
60  INTDBG("\tsymbol=%s\n", ue->symbol);
61  INTDBG("\toperation=%s\n", ue->operation);
62  INTDBG("\tcount=%d\n", ue->count);
63 }
void
Definition: iozone.c:18627
#define INTDBG(format, args...)
Definition: papi_debug.h:65
char symbol[PAPI_MIN_STR_LEN]
char operation[USER_EVENT_OPERATION_LEN]

Here is the caller graph for this function:

int renumber_ops_string ( char *  dest,
char *  src,
int  start 
)

Definition at line 278 of file papi_user_events.c.

278  {
279  char *saveptr, *subtoken;
280  char *pass;
281  char temp[PAPI_MIN_STR_LEN];
282  char orig[PAPI_MIN_STR_LEN];
283 
284  memcpy(orig, src, PAPI_MIN_STR_LEN);
285  pass = orig;
286 
287  while ( (subtoken = strtok_r( pass, "|", &saveptr)) != NULL ) {
288  pass = NULL;
289  if ( subtoken[0] == 'N' ) {
290  sprintf(temp, "N%d|", start++);
291  strcat(dest, temp);
292  } else {
293  strcat(dest, subtoken);
294  strcat(dest, "|");
295  }
296  }
297  return start;
298 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
start
Definition: iozone.c:22736
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
strcat(command, mountname)
int temp
Definition: iozone.c:22158

Here is the call graph for this function:

Here is the caller graph for this function:

static char* trim_note ( char *  in)
inlinestatic

Definition at line 175 of file papi_user_events.c.

176 {
177  int len;
178  char *note, start, end;
179 
180  note = trim_string( in );
181  if ( note != NULL ) {
182  len = ( int ) strlen( note );
183  if ( len > 0 ) {
184  if ( ispunct( *note ) ) {
185  start = *note;
186  end = note[len - 1];
187  if ( ( start == end )
188  || ( ( start == '(' ) && ( end == ')' ) )
189  || ( ( start == '<' ) && ( end == '>' ) )
190  || ( ( start == '{' ) && ( end == '}' ) )
191  || ( ( start == '[' ) && ( end == ']' ) ) ) {
192  note[len - 1] = '\0';
193  *note = '\0';
194  note++;
195  }
196  }
197  }
198  }
199  return ( note );
200 }
start
Definition: iozone.c:22736
static char * trim_string(char *in)
int
Definition: iozone.c:18528

Here is the call graph for this function:

static char* trim_string ( char *  in)
inlinestatic

Definition at line 138 of file papi_user_events.c.

139 {
140  int len, i = 0;
141  char *start = in;
142 
143  if ( in == NULL )
144  return ( in );
145  len = ( int ) strlen( in );
146  if ( len == 0 )
147  return ( in );
148  /* Trim left */
149  while ( i < len ) {
150  if ( isblank( in[i] ) ) {
151  in[i] = '\0';
152  start++;
153  } else
154  break;
155  i++;
156  }
157  /* Trim right */
158  i = ( int ) strlen( start ) - 1;
159  while ( i >= 0 ) {
160  if ( isblank( start[i] ) )
161  start[i] = '\0';
162  else
163  break;
164  i--;
165  }
166  return ( start );
167 }
start
Definition: iozone.c:22736
int i
Definition: fileop.c:140
int
Definition: iozone.c:18528

Here is the caller graph for this function:

Variable Documentation

user_defined_event_t* _papi_user_events = NULL

Definition at line 47 of file papi_user_events.c.

unsigned int _papi_user_events_count = 0

Definition at line 48 of file papi_user_events.c.

list_t defines

Definition at line 49 of file papi_user_events.c.

int first_time = 1

Definition at line 50 of file papi_user_events.c.

unsigned int PAPI_NATIVE_EVENT_SHIFT

Definition at line 1084 of file perfmon-ia64.c.

unsigned int PAPI_NATIVE_UMASK_SHIFT

Definition at line 1087 of file perfmon-ia64.c.