PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
aix.c
Go to the documentation of this file.
1 /* This file handles the OS dependent part of the POWER5 and POWER6 architectures.
2  It supports both AIX 4 and AIX 5. The switch between AIX 4 and 5 is driven by the
3  system defined value _AIX_VERSION_510.
4  Other routines also include minor conditionally compiled differences.
5 */
6 
7 #include <sys/utsname.h>
8 
9 #include "papi.h"
10 #include "papi_internal.h"
11 #include "papi_lock.h"
12 
13 #include "papi_memory.h"
14 
15 #include "extras.h"
16 
17 #include "aix.h"
18 #include "papi_vector.h"
19 
20 /* Advance declarations */
22 
23 /* Locking variables */
24 volatile int lock_var[PAPI_MAX_LOCK] = { 0 };
25 atomic_p lock[PAPI_MAX_LOCK];
26 
27 /*
28  some heap information, start_of_text, start_of_data .....
29  ref: http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/sys_mem_alloc.htm#HDRA9E4A4C9921SYLV
30 */
31 #define START_OF_TEXT &_text
32 #define END_OF_TEXT &_etext
33 #define START_OF_DATA &_data
34 #define END_OF_DATA &_edata
35 #define START_OF_BSS &_edata
36 #define END_OF_BSS &_end
37 
38 static int maxgroups = 0;
39 struct utsname AixVer;
40 
42 
44 pm_groups_info_t pmgroups;
48 
49 /* to initialize the native_table */
50 void
52 {
53  int i, j;
54 
55  memset( native_table, 0,
57  memset( native_name_map, 0,
59  for ( i = 0; i < PAPI_MAX_NATIVE_EVENTS; i++ ) {
60  native_name_map[i].index = -1;
61  for ( j = 0; j < MAX_COUNTERS; j++ )
62  native_table[i].resources.counter_cmd[j] = -1;
63  }
64 }
65 
66 /* to setup native_table group value */
67 static void
69 {
70  int i, j, gnum;
71 
72  for ( i = 0; i < total; i++ ) {
73  for ( j = 0; j < MAX_COUNTERS; j++ ) {
74  /* native_table[i].resources.rgg[j]=-1; */
75  if ( native_table[i].resources.selector & ( 1 << j ) ) {
76  for ( gnum = 0; gnum < pmgroups.maxgroups; gnum++ ) {
77  if ( native_table[i].resources.counter_cmd[j] ==
78  pmgroups.event_groups[gnum].events[j] ) {
79  /* could use gnum instead of pmgroups.event_groups[gnum].group_id */
80  native_table[i].resources.group[pmgroups.
81  event_groups[gnum].
82  group_id / 32] |=
83  1 << ( pmgroups.event_groups[gnum].group_id % 32 );
84  }
85  }
86  }
87  }
88  }
89 
90  for ( gnum = 0; gnum < pmgroups.maxgroups; gnum++ ) {
91  for ( i = 0; i < MAX_COUNTERS; i++ ) {
92  /*group_map[gnum].counter_cmd[i] = pmgroups.event_groups[gnum].events[i]; */
93  if (pmgroups.event_groups[gnum].group_id >=MAX_GROUPS) {
94  fprintf(stderr,"ERROR, group number trying to go past MAX GROUPS\n");
95  continue;
96  }
97 
98  group_map[pmgroups.event_groups[gnum].group_id].counter_cmd[i] =
99  pmgroups.event_groups[gnum].events[i];
100  }
101  }
102 }
103 
104 /* to setup native_table values, and return number of entries */
105 int
107 {
108  hwd_pmevents_t *wevp;
109  hwd_pminfo_t *info;
110  int pmc, ev, i, j, index;
111 
112  info = &pminfo;
113  index = 0;
115  for ( pmc = 0; pmc < info->maxpmcs; pmc++ ) {
116  wevp = info->list_events[pmc];
117  for ( ev = 0; ev < info->maxevents[pmc]; ev++, wevp++ ) {
118  for ( i = 0; i < index; i++ ) {
119  if ( strcmp( wevp->short_name, native_table[i].name ) == 0 ) {
120  native_table[i].resources.selector |= 1 << pmc;
121  native_table[i].resources.counter_cmd[pmc] = wevp->event_id;
122  break;
123  }
124  }
125  if ( i == index ) {
126  /*native_table[i].index=i; */
127  native_table[i].resources.selector |= 1 << pmc;
128  native_table[i].resources.counter_cmd[pmc] = wevp->event_id;
129  native_table[i].name = wevp->short_name;
130  native_table[i].description = wevp->description;
131  native_name_map[i].name = native_table[i].name;
132  native_name_map[i].index = i;
133  index++;
134  }
135  }
136  }
137  aix_ppc64_setup_gps( index );
138 
139  return index;
140 }
141 
142 /* Reports the elements of the hwd_register_t struct as an array of names and a matching array of values.
143  Maximum string length is name_len; Maximum number of values is count.
144 */
145 static void
146 copy_value( unsigned int val, char *nam, char *names, unsigned int *values,
147  int len )
148 {
149  *values = val;
150  strncpy( names, nam, len );
151  names[len - 1] = '\0';
152 }
153 
154 
155 /* this function recusively does Modified Bipartite Graph counter allocation
156  success return 1
157  fail return 0
158 */
159 static int
161 {
162  int i, j, group = -1;
163  unsigned int map[GROUP_INTS];
164 
165  for ( i = 0; i < GROUP_INTS; i++ )
166  map[i] = event_list[0].ra_group[i];
167 
168  for ( i = 1; i < size; i++ ) {
169  for ( j = 0; j < GROUP_INTS; j++ )
170  map[j] &= event_list[i].ra_group[j];
171  }
172 
173  for ( i = 0; i < GROUP_INTS; i++ ) {
174  if ( map[i] ) {
175  group = ffs( map[i] ) - 1 + i * 32;
176  break;
177  }
178  }
179 
180  if ( group < 0 )
181  return group; /* allocation fail */
182  else {
183  for ( i = 0; i < size; i++ ) {
184  for ( j = 0; j < MAX_COUNTERS; j++ ) {
185  if ( event_list[i].ra_counter_cmd[j] >= 0
186  && event_list[i].ra_counter_cmd[j] ==
187  group_map[group].counter_cmd[j] )
188  event_list[i].ra_position = j;
189  }
190  }
191  return group;
192  }
193 }
194 
195 
196 /* this function will be called when there are counters available
197  success return 1
198  fail return 0
199 */
200 int
202 {
203  hwd_control_state_t *this_state = ESI->ctl_state;
204  unsigned char selector;
205  int i, j, natNum, index;
206  ppc64_reg_alloc_t event_list[MAX_COUNTERS];
207  int position, group;
208 
209 
210  /* not yet successfully mapped, but have enough slots for events */
211 
212  /* Initialize the local structure needed
213  for counter allocation and optimization. */
214  natNum = ESI->NativeCount;
215  for ( i = 0; i < natNum; i++ ) {
216  /* CAUTION: Since this is in the hardware layer, it's ok
217  to access the native table directly, but in general this is a bad idea */
218  event_list[i].ra_position = -1;
219  /* calculate native event rank, which is number of counters it can live on, this is power3 specific */
220  for ( j = 0; j < MAX_COUNTERS; j++ ) {
221  if ( ( index =
222  native_name_map[ESI->NativeInfoArray[i].
223  ni_event & PAPI_NATIVE_AND_MASK].index ) <
224  0 )
225  return PAPI_ECNFLCT;
226  event_list[i].ra_counter_cmd[j] =
227  native_table[index].resources.counter_cmd[j];
228  }
229  for ( j = 0; j < GROUP_INTS; j++ ) {
230  if ( ( index =
231  native_name_map[ESI->NativeInfoArray[i].
232  ni_event & PAPI_NATIVE_AND_MASK].index ) <
233  0 )
234  return PAPI_ECNFLCT;
235  event_list[i].ra_group[j] = native_table[index].resources.group[j];
236  }
237  /*event_list[i].ra_mod = -1; */
238  }
239 
240  if ( ( group = do_counter_allocation( event_list, natNum ) ) >= 0 ) { /* successfully mapped */
241  /* copy counter allocations info back into NativeInfoArray */
242  this_state->group_id = group;
243  for ( i = 0; i < natNum; i++ )
244  ESI->NativeInfoArray[i].ni_position = event_list[i].ra_position;
245  /* update the control structure based on the NativeInfoArray */
246  /*_papi_hwd_update_control_state(this_state, ESI->NativeInfoArray, natNum);*/
247  return PAPI_OK;
248  } else {
249  return PAPI_ECNFLCT;
250  }
251 }
252 
253 int
255 {
256  int i;
257 
258  for ( i = 0; i < _aix_vector.cmp_info.num_cntrs; i++ ) {
259  ptr->counter_cmd.events[i] = COUNT_NOTHING;
260  }
261  ptr->counter_cmd.mode.b.is_group = 1;
262 
263  _aix_vector.set_domain( ptr, _aix_vector.cmp_info.default_domain );
265  /*setup_native_table(); */
266  return ( PAPI_OK );
267 }
268 
269 
270 /* This function updates the control structure with whatever resources are allocated
271  for all the native events in the native info structure array. */
272 int
274  NativeInfo_t * native, int count,
275  hwd_context_t * context )
276 {
277 
278  this_state->counter_cmd.events[0] = this_state->group_id;
279  return PAPI_OK;
280 }
281 
282 
283 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
284  /* The following is for any POWER hardware */
285 
286 /* Trims trailing blank space and line endings from a string (in place).
287  Returns pointer to start address */
288 static char *
289 trim_string( char *in )
290 {
291  int len, i = 0;
292  char *start = in;
293 
294  if ( in == NULL )
295  return ( in );
296  len = strlen( in );
297  if ( len == 0 )
298  return ( in );
299  /* Trim right */
300  i = strlen( start ) - 1;
301  while ( i >= 0 ) {
302  if ( isblank( start[i] ) || ( start[i] == '\r' ) ||
303  ( start[i] == '\n' ) )
304  start[i] = '\0';
305  else
306  break;
307  i--;
308  }
309  return ( start );
310 }
311 
312 
313 /* Routines to support an opaque native event table */
314 int
315 _aix_ntv_code_to_name( unsigned int EventCode, char *ntv_name, int len )
316 {
317  if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
318  _aix_vector.cmp_info.num_native_events )
319  return ( PAPI_ENOEVNT );
320  strncpy( ntv_name,
321  native_name_map[EventCode & PAPI_NATIVE_AND_MASK].name, len );
322  trim_string( ntv_name );
323  if ( strlen( native_name_map[EventCode & PAPI_NATIVE_AND_MASK].name ) >
324  len - 1 )
325  return ( PAPI_EBUF );
326  return ( PAPI_OK );
327 }
328 
329 int
330 _aix_ntv_code_to_descr( unsigned int EventCode, char *ntv_descr, int len )
331 {
332  if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
333  _aix_vector.cmp_info.num_native_events )
334  return ( PAPI_ENOEVNT );
335  strncpy( ntv_descr,
336  native_table[native_name_map[EventCode & PAPI_NATIVE_AND_MASK].
337  index].description, len );
338  trim_string( ntv_descr );
339  if ( strlen
340  ( native_table
341  [native_name_map[EventCode & PAPI_NATIVE_AND_MASK].index].
342  description ) > len - 1 )
343  return ( PAPI_EBUF );
344  return ( PAPI_OK );
345 }
346 
347 int
348 _aix_ntv_code_to_bits( unsigned int EventCode, hwd_register_t * bits )
349 {
350  bits = &native_table[EventCode & PAPI_NATIVE_AND_MASK].resources; /* it is not right, different type */
351  return ( PAPI_OK );
352 }
353 
354 /* this function return the next native event code.
355  modifier = PAPI_ENUM_FIRST returns first native event code
356  modifier = PAPI_ENUM_EVENTS returns next native event code
357  modifier = PAPI_NTV_ENUM_GROUPS return groups in which this
358  native event lives, in bits 16 - 23 of event code
359  terminating with PAPI_ENOEVNT at the end of the list.
360  function return value:
361  PAPI_OK successful, event code is valid
362  PAPI_EINVAL bad modifier
363  PAPI_ENOEVNT end of list or fail, event code is invalid
364 */
365 int
366 _aix_ntv_enum_events( unsigned int *EventCode, int modifier )
367 {
368  if ( modifier == PAPI_ENUM_FIRST ) {
369  *EventCode = PAPI_NATIVE_MASK;
370  return ( PAPI_OK );
371  }
372  if ( modifier == PAPI_ENUM_EVENTS ) {
373  int index = *EventCode & PAPI_NATIVE_AND_MASK;
374 
375  if ( native_table[index + 1].resources.selector ) {
376  *EventCode = *EventCode + 1;
377  return ( PAPI_OK );
378  } else
379  return ( PAPI_ENOEVNT );
380  } else if ( modifier == PAPI_NTV_ENUM_GROUPS ) {
381 #if defined(_POWER5) || defined(_POWER6)
382  unsigned int group =
383  ( *EventCode & PAPI_NTV_GROUP_AND_MASK ) >> PAPI_NTV_GROUP_SHIFT;
384  int index = *EventCode & 0x000000FF;
385  int i;
386  unsigned int tmpg;
387 
388  *EventCode = *EventCode & ( ~PAPI_NTV_GROUP_SHIFT );
389  for ( i = 0; i < GROUP_INTS; i++ ) {
390  tmpg = native_table[index].resources.group[i];
391  if ( group != 0 ) {
392  while ( ( ffs( tmpg ) + i * 32 ) <= group && tmpg != 0 )
393  tmpg = tmpg ^ ( 1 << ( ffs( tmpg ) - 1 ) );
394  }
395  if ( tmpg != 0 ) {
396  group = ffs( tmpg ) + i * 32;
397  *EventCode = *EventCode | ( group << PAPI_NTV_GROUP_SHIFT );
398  return ( PAPI_OK );
399  }
400  }
401 #endif
402  return ( PAPI_ENOEVNT );
403  } else
404  return ( PAPI_EINVAL );
405 }
406 
407 static void
408 set_config( hwd_control_state_t * ptr, int arg1, int arg2 )
409 {
410  ptr->counter_cmd.events[arg1] = arg2;
411 }
412 
413 static void
415 {
416  ptr->counter_cmd.events[arg1] = 0;
417 }
418 
419 int
421 {
422  int domain = 0;
423 
425 #ifdef PM_INITIALIZE
426 #ifdef _AIXVERSION_510
427  if ( pminfo.proc_feature.b.hypervisor ) {
428  domain |= PAPI_DOM_SUPERVISOR;
429  }
430 #endif
431 #endif
432  return ( domain );
433 }
434 
435 static int
436 _aix_set_domain( hwd_control_state_t * this_state, int domain )
437 {
438  pm_mode_t *mode = &( this_state->counter_cmd.mode );
439  int did = 0;
440 
441  mode->b.user = 0;
442  mode->b.kernel = 0;
443  if ( domain & PAPI_DOM_USER ) {
444  did++;
445  mode->b.user = 1;
446  }
447  if ( domain & PAPI_DOM_KERNEL ) {
448  did++;
449  mode->b.kernel = 1;
450  }
451 #ifdef PM_INITIALIZE
452 #ifdef _AIXVERSION_510
453  if ( ( domain & PAPI_DOM_SUPERVISOR ) && pminfo.proc_feature.b.hypervisor ) {
454  did++;
455  mode->b.hypervisor = 1;
456  }
457 #endif
458 #endif
459  if ( did )
460  return ( PAPI_OK );
461  else
462  return ( PAPI_EINVAL );
463 /*
464  switch (domain)
465  {
466  case PAPI_DOM_USER:
467  mode->b.user = 1;
468  mode->b.kernel = 0;
469  break;
470  case PAPI_DOM_KERNEL:
471  mode->b.user = 0;
472  mode->b.kernel = 1;
473  break;
474  case PAPI_DOM_ALL:
475  mode->b.user = 1;
476  mode->b.kernel = 1;
477  break;
478  default:
479  return(PAPI_EINVAL);
480  }
481  return(PAPI_OK);
482 */
483 }
484 
485 int
486 _aix_set_granularity( hwd_control_state_t * this_state, int domain )
487 {
488  pm_mode_t *mode = &( this_state->counter_cmd.mode );
489 
490  switch ( domain ) {
491  case PAPI_GRN_THR:
492  mode->b.process = 0;
493  mode->b.proctree = 0;
494  break;
495  /* case PAPI_GRN_PROC:
496  mode->b.process = 1;
497  mode->b.proctree = 0;
498  break;
499  case PAPI_GRN_PROCG:
500  mode->b.process = 0;
501  mode->b.proctree = 1;
502  break; */
503  default:
504  return ( PAPI_EINVAL );
505  }
506  return ( PAPI_OK );
507 }
508 
509 static int
510 set_default_domain( EventSetInfo_t * zero, int domain )
511 {
512  hwd_control_state_t *current_state = zero->ctl_state;
513  return ( _aix_set_domain( current_state, domain ) );
514 }
515 
516 static int
517 set_default_granularity( EventSetInfo_t * zero, int granularity )
518 {
519  hwd_control_state_t *current_state = zero->ctl_state;
520  return ( _aix_set_granularity( current_state, granularity ) );
521 }
522 
523 /* Initialize the system-specific settings */
524 /* Machine info structure. -1 is unused. */
525 int
527 {
528  int retval;
529 
530  if ( ( retval = uname( &AixVer ) ) < 0 )
531  return ( PAPI_ESYS );
532  if ( AixVer.version[0] == '4' ) {
534  ( caddr_t ) START_OF_TEXT;
536  ( caddr_t ) END_OF_TEXT;
538  ( caddr_t ) START_OF_DATA;
540  ( caddr_t ) END_OF_DATA;
542  ( caddr_t ) START_OF_BSS;
544  ( caddr_t ) END_OF_BSS;
545  } else {
547  }
548 
549 /* _papi_hwi_system_info.supports_64bit_counters = 1;
550  _papi_hwi_system_info.supports_real_usec = 1;
551  _papi_hwi_system_info.sub_info.fast_real_timer = 1;
552  _papi_hwi_system_info.sub_info->available_domains = init_domain();*/
553 
554 
555  return ( PAPI_OK );
556 }
557 
558 
559 static int
561 {
562  int retval;
563  /* pm_info_t pminfo; */
564  struct procsinfo psi = { 0 };
565  pid_t pid;
566  char maxargs[PAPI_HUGE_STR_LEN];
567  char pname[PAPI_HUGE_STR_LEN];
568 
569  pid = getpid( );
570  if ( pid == -1 )
571  return ( PAPI_ESYS );
573  psi.pi_pid = pid;
574  retval = getargs( &psi, sizeof ( psi ), maxargs, PAPI_HUGE_STR_LEN );
575  if ( retval == -1 )
576  return ( PAPI_ESYS );
577 
578  if ( realpath( maxargs, pname ) )
579  strncpy( _papi_hwi_system_info.exe_info.fullname, pname,
581  else
582  strncpy( _papi_hwi_system_info.exe_info.fullname, maxargs,
584 
586  basename( maxargs ) );
587 
588 #ifdef _POWER7
589  /* we pass PM_POWER7 for the same reasons as below (power6 case) */
590  retval = pm_initialize( PM_INIT_FLAGS , &pminfo, &pmgroups, PM_POWER7);
591 #elif defined(_POWER6)
592  /* problem with pm_initialize(): it cannot be called multiple times with
593  PM_CURRENT; use instead the actual proc type - here PM_POWER6 -
594  and multiple invocations are no longer a problem */
595  retval = pm_initialize( PM_INIT_FLAGS, &pminfo, &pmgroups, PM_POWER6 );
596 #else
597 #ifdef _AIXVERSION_510
598 #ifdef PM_INITIALIZE
599  SUBDBG( "Calling AIX 5 version of pm_initialize...\n" );
600 /*#if defined(_POWER5)
601  retval = pm_initialize(PM_INIT_FLAGS, &pminfo, &pmgroups, PM_POWER5);
602 #endif*/
603  retval = pm_initialize( PM_INIT_FLAGS, &pminfo, &pmgroups, PM_CURRENT );
604 #else
605  SUBDBG( "Calling AIX 5 version of pm_init...\n" );
606  retval = pm_init( PM_INIT_FLAGS, &pminfo, &pmgroups );
607 #endif
608 
609 #else
610  SUBDBG( "Calling AIX 4 version of pm_init...\n" );
611  retval = pm_init( PM_INIT_FLAGS, &pminfo );
612 #endif
613 #endif
614  SUBDBG( "...Back from pm_init\n" );
615 
616  if ( retval > 0 )
617  return ( retval );
618 
619  _aix_mdi_init( );
620 
622  _papi_hwi_system_info.hw_info.ncpu = _system_configuration.ncpus;
628  _papi_hwi_system_info.hw_info.model = _system_configuration.implementation;
631  ( float ) _system_configuration.version;
632  _papi_hwi_system_info.hw_info.mhz = ( float ) ( pm_cycles( ) / 1000000.0 );
635 
636 /* _papi_hwi_system_info.num_gp_cntrs = pminfo.maxpmcs;*/
637  _aix_vector.cmp_info.num_cntrs = pminfo.maxpmcs;
638  _aix_vector.cmp_info.num_mpx_cntrs = MAX_MPX_COUNTERS; // pminfo.maxpmcs,
639 
641 /* This field doesn't appear to exist in the PAPI 3.0 structure
642  _papi_hwi_system_info.cpunum = mycpu();
643 */
644  _aix_vector.cmp_info.available_domains = init_domain( );
645  return PAPI_OK;
646 }
647 
648 /* Low level functions, should not handle errors, just return codes. */
649 
650 /* At init time, the higher level library should always allocate and
651  reserve EventSet zero. */
652 
653 long long
655 {
656  timebasestruct_t t;
657  long long retval;
658 
659  read_real_time( &t, TIMEBASE_SZ );
660  time_base_to_time( &t, TIMEBASE_SZ );
661  retval = ( t.tb_high * 1000000 ) + t.tb_low / 1000;
662  return ( retval );
663 }
664 
665 long long
667 {
668  return ( _aix_get_real_usec( ) *
669  ( long long ) _papi_hwi_system_info.hw_info.cpu_max_mhz );
670 }
671 
672 long long
674 {
675  long long retval;
676  struct tms buffer;
677 
678  times( &buffer );
679  SUBDBG( "user %d system %d\n", ( int ) buffer.tms_utime,
680  ( int ) buffer.tms_stime );
681  retval =
682  ( long long ) ( ( buffer.tms_utime + buffer.tms_stime ) *
683  ( 1000000 / CLK_TCK ) );
684  return ( retval );
685 }
686 
687 static void
689 {
690  int i;
691  for ( i = 0; i < PAPI_MAX_LOCK; i++ )
692  lock[i] = ( int * ) ( lock_var + i );
693 }
694 
695 int
697 {
698  return ( PAPI_OK );
699 }
700 
701 int
703 {
704  int retval = PAPI_OK, procidx;
705 
706  /* Fill in what we can of the papi_system_info. */
708  if ( retval )
709  return ( retval );
710 
711  /* Setup memory info */
713  if ( retval )
714  return ( retval );
715 
716  SUBDBG( "Found %d %s %s CPUs at %d Mhz.\n",
721 
722  _aix_vector.cmp_info.CmpIdx = cidx;
724 
725  procidx = pm_get_procindex( );
726  switch ( procidx ) {
727  case PM_POWER5:
728  _papi_load_preset_table( "POWER5", 0, cidx );
729  break;
730  case PM_POWER5_II:
731  _papi_load_preset_table( "POWER5+", 0, cidx );
732  break;
733  case PM_POWER6:
734  _papi_load_preset_table( "POWER6", 0, cidx );
735  break;
736  case PM_PowerPC970:
737  _papi_load_preset_table( "PPC970", 0, cidx );
738  break;
739  case PM_POWER7:
740  _papi_load_preset_table( "POWER7", 0, cidx );
741  break;
742  default:
743  fprintf( stderr, "%s is not supported!\n", pminfo.proc_name );
744  return PAPI_ENOIMPL;
745  }
746 
747  _aix_lock_init( );
748 
749  return ( retval );
750 }
751 
752 
753 int
755 {
756  int retval;
757  /* Initialize our global control state. */
758 
759  _aix_init_control_state( &context->cntrl );
760 }
761 
762 /* Go from highest counter to lowest counter. Why? Because there are usually
763  more counters on #1, so we try the least probable first. */
764 
765 static int
766 get_avail_hwcntr_bits( int cntr_avail_bits )
767 {
768  int tmp = 0, i = 1 << ( POWER_MAX_COUNTERS - 1 );
769 
770  while ( i ) {
771  tmp = i & cntr_avail_bits;
772  if ( tmp )
773  return ( tmp );
774  i = i >> 1;
775  }
776  return ( 0 );
777 }
778 
779 static void
780 set_hwcntr_codes( int selector, unsigned char *from, int *to )
781 {
782  int useme, i;
783 
784  for ( i = 0; i < _aix_vector.cmp_info.num_cntrs; i++ ) {
785  useme = ( 1 << i ) & selector;
786  if ( useme ) {
787  to[i] = from[i];
788  }
789  }
790 }
791 
792 
793 #ifdef DEBUG
794 void
795 dump_cmd( pm_prog_t * t )
796 {
797  SUBDBG( "mode.b.threshold %d\n", t->mode.b.threshold );
798  SUBDBG( "mode.b.spare %d\n", t->mode.b.spare );
799  SUBDBG( "mode.b.process %d\n", t->mode.b.process );
800  SUBDBG( "mode.b.kernel %d\n", t->mode.b.kernel );
801  SUBDBG( "mode.b.user %d\n", t->mode.b.user );
802  SUBDBG( "mode.b.count %d\n", t->mode.b.count );
803  SUBDBG( "mode.b.proctree %d\n", t->mode.b.proctree );
804  SUBDBG( "events[0] %d\n", t->events[0] );
805  SUBDBG( "events[1] %d\n", t->events[1] );
806  SUBDBG( "events[2] %d\n", t->events[2] );
807  SUBDBG( "events[3] %d\n", t->events[3] );
808  SUBDBG( "events[4] %d\n", t->events[4] );
809  SUBDBG( "events[5] %d\n", t->events[5] );
810  SUBDBG( "events[6] %d\n", t->events[6] );
811  SUBDBG( "events[7] %d\n", t->events[7] );
812  SUBDBG( "reserved %d\n", t->reserved );
813 }
814 
815 void
816 dump_data( long long *vals )
817 {
818  int i;
819 
820  for ( i = 0; i < MAX_COUNTERS; i++ ) {
821  SUBDBG( "counter[%d] = %lld\n", i, vals[i] );
822  }
823 }
824 #endif
825 
826 int
828 {
829  int retval = pm_reset_data_mythread( );
830  if ( retval > 0 ) {
832  pm_error( "PAPI Error: pm_reset_data_mythread", retval );
833  return ( retval );
834  }
835  return ( PAPI_OK );
836 }
837 
838 
839 int
841  long long **vals, int flags )
842 {
843  int retval;
844 
845  retval = pm_get_data_mythread( &spc->state );
846  if ( retval > 0 ) {
848  pm_error( "PAPI Error: pm_get_data_mythread", retval );
849  return ( retval );
850  }
851 
852  *vals = spc->state.accu;
853 
854 #ifdef DEBUG
855  if ( ISLEVEL( DEBUG_SUBSTRATE ) )
856  dump_data( *vals );
857 #endif
858 
859  return ( PAPI_OK );
860 }
861 
862 static int
864 {
865  if ( ns <= _papi_os_info.itimer_res_ns ) {
867  } else {
868  int leftover_ns = ns % _papi_os_info.itimer_res_ns;
869  return ( ns - leftover_ns + _papi_os_info.itimer_res_ns );
870  }
871 }
872 
873 int
874 _aix_ctl( hwd_context_t * ctx, int code, _papi_int_option_t * option )
875 {
876  switch ( code ) {
877 /* I don't understand what it means to set the default domain
878  case PAPI_DEFDOM:
879  return(set_default_domain(zero, option->domain.domain));
880 */
881  case PAPI_DOMAIN:
882  return ( _aix_set_domain
883  ( option->domain.ESI->ctl_state, option->domain.domain ) );
884 /* I don't understand what it means to set the default granularity
885  case PAPI_DEFGRN:
886  return(set_default_granularity(zero, option->granularity.granularity));
887 */
888  case PAPI_GRANUL:
889  return ( _aix_set_granularity
890  ( option->domain.ESI->ctl_state,
891  option->granularity.granularity ) );
892 #if 0
893  case PAPI_INHERIT:
894  return ( set_inherit( option->inherit.inherit ) );
895 #endif
896  case PAPI_DEF_ITIMER:
897  {
898  /* flags are currently ignored, eventually the flags will be able
899  to specify whether or not we use POSIX itimers (clock_gettimer) */
900  if ( ( option->itimer.itimer_num == ITIMER_REAL ) &&
901  ( option->itimer.itimer_sig != SIGALRM ) )
902  return PAPI_EINVAL;
903  if ( ( option->itimer.itimer_num == ITIMER_VIRTUAL ) &&
904  ( option->itimer.itimer_sig != SIGVTALRM ) )
905  return PAPI_EINVAL;
906  if ( ( option->itimer.itimer_num == ITIMER_PROF ) &&
907  ( option->itimer.itimer_sig != SIGPROF ) )
908  return PAPI_EINVAL;
909  if ( option->itimer.ns > 0 )
910  option->itimer.ns = round_requested_ns( option->itimer.ns );
911  /* At this point, we assume the user knows what he or
912  she is doing, they maybe doing something arch specific */
913  return PAPI_OK;
914  }
915  case PAPI_DEF_MPX_NS:
916  {
917  option->multiplex.ns = round_requested_ns( option->multiplex.ns );
918  return ( PAPI_OK );
919  }
920  case PAPI_DEF_ITIMER_NS:
921  {
922  option->itimer.ns = round_requested_ns( option->itimer.ns );
923  return ( PAPI_OK );
924  }
925  default:
926  return ( PAPI_ENOSUPP );
927  }
928 }
929 
930 void
931 _aix_dispatch_timer( int signal, siginfo_t * si, void *i )
932 {
934  ThreadInfo_t *t = NULL;
935  caddr_t address;
936 
937  ctx.si = si;
938  ctx.ucontext = ( hwd_ucontext_t * ) i;
939 
940  address = ( caddr_t ) GET_OVERFLOW_ADDRESS( ( &ctx ) );
941  _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address, NULL, 0, 0,
942  &t, _aix_vector.cmp_info.CmpIdx );
943 }
944 
945 int
946 _aix_set_overflow( EventSetInfo_t * ESI, int EventIndex, int threshold )
947 {
948  hwd_control_state_t *this_state = ESI->ctl_state;
949 
950  return ( PAPI_OK );
951 }
952 
953 void *
955 {
956  void *location;
957  struct sigcontext *info = ( struct sigcontext * ) context;
958  location = ( void * ) info->sc_jmpbuf.jmp_context.iar;
959 
960  return ( location );
961 }
962 
963 
964 /* Copy the current control_state into the new thread context */
965 /*int _papi_hwd_start(EventSetInfo_t *ESI, EventSetInfo_t *zero)*/
966 int
968 {
969  int i, retval;
970  hwd_control_state_t *current_state = &ctx->cntrl;
971 
972  /* If we are nested, merge the global counter structure
973  with the current eventset */
974 
975  SUBDBG( "Start\n" );
976 
977  /* Copy the global counter structure to the current eventset */
978 
979  SUBDBG( "Copying states\n" );
980  memcpy( current_state, cntrl, sizeof ( hwd_control_state_t ) );
981 
982  retval = pm_set_program_mythread( &current_state->counter_cmd );
983  if ( retval > 0 ) {
984  if ( retval == 13 ) {
985  retval = pm_delete_program_mythread( );
986  if ( retval > 0 ) {
988  pm_error( "PAPI Error: pm_delete_program_mythread",
989  retval );
990  return ( retval );
991  }
992  retval = pm_set_program_mythread( &current_state->counter_cmd );
993  if ( retval > 0 ) {
995  pm_error( "PAPI Error: pm_set_program_mythread", retval );
996  return ( retval );
997  }
998  } else {
1000  pm_error( "PAPI Error: pm_set_program_mythread", retval );
1001  return ( retval );
1002  }
1003  }
1004 
1005  /* Set up the new merged control structure */
1006 
1007 #if 0
1008  dump_cmd( &current_state->counter_cmd );
1009 #endif
1010 
1011  /* Start the counters */
1012 
1013  retval = pm_start_mythread( );
1014  if ( retval > 0 ) {
1016  pm_error( "pm_start_mythread()", retval );
1017  return ( retval );
1018  }
1019 
1020  return ( PAPI_OK );
1021 }
1022 
1023 int
1025 {
1026  int retval;
1027 
1028  retval = pm_stop_mythread( );
1029  if ( retval > 0 ) {
1031  pm_error( "pm_stop_mythread()", retval );
1032  return ( retval );
1033  }
1034 
1035  retval = pm_delete_program_mythread( );
1036  if ( retval > 0 ) {
1038  pm_error( "pm_delete_program_mythread()", retval );
1039  return ( retval );
1040  }
1041 
1042  return ( PAPI_OK );
1043 }
1044 
1045 int
1047 {
1048 #if ( ( defined( _AIXVERSION_510) || defined(_AIXVERSION_520)))
1049  struct ma_msg_s
1050  {
1051  long flag;
1052  char *name;
1053  } ma_msgs[] = {
1054  {
1055  MA_MAINEXEC, "MAINEXEC"}, {
1056  MA_KERNTEXT, "KERNTEXT"}, {
1057  MA_READ, "READ"}, {
1058  MA_WRITE, "WRITE"}, {
1059  MA_EXEC, "EXEC"}, {
1060  MA_SHARED, "SHARED"}, {
1061  MA_BREAK, "BREAK"}, {
1062  MA_STACK, "STACK"},};
1063 
1064  char fname[80], name[PAPI_HUGE_STR_LEN];
1065  prmap_t newp;
1066  int count, t_index, retval, i, j, not_first_flag_bit;
1067  FILE *map_f;
1068  void *vaddr;
1069  prmap_t *tmp1 = NULL;
1070  PAPI_address_map_t *tmp2 = NULL;
1071 
1072  sprintf( fname, "/proc/%d/map", getpid( ) );
1073  map_f = fopen( fname, "r" );
1074  if ( !map_f ) {
1075  PAPIERROR( "fopen(%s) returned < 0", fname );
1076  return ( PAPI_OK );
1077  }
1078 
1079  /* count the entries we need */
1080  count = 0;
1081  t_index = 0;
1082  while ( ( retval = fread( &newp, sizeof ( prmap_t ), 1, map_f ) ) > 0 ) {
1083  if ( newp.pr_pathoff > 0 && newp.pr_mapname[0] != '\0' ) {
1084  if ( newp.pr_mflags & MA_STACK )
1085  continue;
1086 
1087  count++;
1088  SUBDBG( "count=%d offset=%ld map=%s\n", count,
1089  newp.pr_pathoff, newp.pr_mapname );
1090 
1091  if ( ( newp.pr_mflags & MA_READ ) && ( newp.pr_mflags & MA_EXEC ) )
1092  t_index++;
1093  }
1094  }
1095  rewind( map_f );
1096  tmp1 = ( prmap_t * ) papi_calloc( ( count + 1 ), sizeof ( prmap_t ) );
1097  if ( tmp1 == NULL )
1098  return ( PAPI_ENOMEM );
1099 
1100  tmp2 =
1101  ( PAPI_address_map_t * ) papi_calloc( t_index,
1102  sizeof ( PAPI_address_map_t ) );
1103  if ( tmp2 == NULL )
1104  return ( PAPI_ENOMEM );
1105 
1106  i = 0;
1107  t_index = -1;
1108  while ( ( retval = fread( &tmp1[i], sizeof ( prmap_t ), 1, map_f ) ) > 0 ) {
1109  if ( tmp1[i].pr_pathoff > 0 && tmp1[i].pr_mapname[0] != '\0' )
1110  if ( !( tmp1[i].pr_mflags & MA_STACK ) )
1111  i++;
1112  }
1113  for ( i = 0; i < count; i++ ) {
1114  char c;
1115  int cc = 0;
1116 
1117  retval = fseek( map_f, tmp1[i].pr_pathoff, SEEK_SET );
1118  if ( retval != 0 )
1119  return ( PAPI_ESYS );
1120  while ( fscanf( map_f, "%c", &c ) != EOF ) {
1121  name[cc] = c;
1122  /* how many char are hold in /proc/xxxx/map */
1123  cc++;
1124  if ( c == '\0' )
1125  break;
1126  }
1127 
1128 
1129  /* currently /proc/xxxx/map file holds only 33 char per line (incl NULL char);
1130  * if executable name > 32 char, compare first 32 char only */
1132  basename( name ), cc - 1 ) == 0 ) {
1134  cc - 1 )
1135  PAPIERROR
1136  ( "executable name too long (%d char). Match of first %d char only",
1138  name ), cc - 1 );
1139 
1140  if ( tmp1[i].pr_mflags & MA_READ ) {
1141  if ( tmp1[i].pr_mflags & MA_EXEC ) {
1143  text_start = ( caddr_t ) tmp1[i].pr_vaddr;
1145  text_end =
1146  ( caddr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1147  } else if ( tmp1[i].pr_mflags & MA_WRITE ) {
1149  data_start = ( caddr_t ) tmp1[i].pr_vaddr;
1151  data_end =
1152  ( caddr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1153  }
1154  }
1155 
1156  } else {
1159  0 ) &&
1162  0 ) )
1163  PAPIERROR( "executable name not recognized" );
1164 
1165  if ( tmp1[i].pr_mflags & MA_READ ) {
1166  if ( tmp1[i].pr_mflags & MA_EXEC ) {
1167  t_index++;
1168  tmp2[t_index].text_start = ( caddr_t ) tmp1[i].pr_vaddr;
1169  tmp2[t_index].text_end =
1170  ( caddr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1171  strncpy( tmp2[t_index].name, name, PAPI_MAX_STR_LEN );
1172  } else if ( tmp1[i].pr_mflags & MA_WRITE ) {
1173  tmp2[t_index].data_start = ( caddr_t ) tmp1[i].pr_vaddr;
1174  tmp2[t_index].data_end =
1175  ( caddr_t ) ( tmp1[i].pr_vaddr + tmp1[i].pr_size );
1176  }
1177  }
1178 
1179  }
1180  }
1181  fclose( map_f );
1182 
1186  _papi_hwi_system_info.shlib_info.count = t_index + 1;
1187  papi_free( tmp1 );
1188 
1189  return PAPI_OK;
1190 #else
1191  return PAPI_ENOIMPL;
1192 #endif
1193 }
1194 
1195 int
1196 _aix_ntv_name_to_code( char *name, unsigned int *evtcode )
1197 {
1198  int i;
1199 
1200  for ( i = 0; i < PAPI_MAX_NATIVE_EVENTS; i++ )
1201  if ( strcmp( name, native_name_map[i].name ) == 0 ) {
1202  *evtcode = native_name_map[i].index | PAPI_NATIVE_MASK;
1203  return PAPI_OK;
1204  }
1205 
1206  return PAPI_ENOEVNT;
1207 }
1208 
1209 
1211 
1212 int
1214 
1215  struct utsname uname_buffer;
1216 
1217  uname(&uname_buffer);
1218 
1219  strncpy(_papi_os_info.name,uname_buffer.sysname,PAPI_MAX_STR_LEN);
1220 
1221  strncpy(_papi_os_info.version,uname_buffer.release,PAPI_MAX_STR_LEN);
1222 
1223  _papi_os_info.itimer_sig = PAPI_INT_MPX_SIGNAL;
1224  _papi_os_info.itimer_num = PAPI_INT_ITIMER;
1225  _papi_os_info.itimer_res_ns = 1;
1226  _papi_os_info.itimer_ns = 1000 * PAPI_INT_MPX_DEF_US;
1227 
1228  return PAPI_OK;
1229 
1230 }
1231 
1232 
1233 papi_vector_t _aix_vector = {
1234  .cmp_info = {
1235  /* default component information (unspecified values are initialized to 0) */
1236 
1237  .name = "aix",
1238  .description = "AIX pmapi CPU counters",
1239  .default_domain = PAPI_DOM_USER,
1240  .available_domains = PAPI_DOM_USER | PAPI_DOM_KERNEL,
1241  .default_granularity = PAPI_GRN_THR,
1242  .available_granularities = PAPI_GRN_THR,
1243  .hardware_intr_sig = PAPI_INT_SIGNAL,
1244 
1245  /* component specific cmp_info initializations */
1246  .fast_real_timer = 1,
1247  .fast_virtual_timer = 1,
1248  .attach = 1,
1249  .attach_must_ptrace = 1,
1250  .cntr_umasks = 1,
1251  }
1252  ,
1253 
1254  /* sizes of framework-opaque component-private structures
1255  these are remapped in pmapi_ppc64.h, ppc64_events.h */
1256  .size = {
1257  .context = sizeof ( hwd_context_t ),
1258  .control_state = sizeof ( hwd_control_state_t ),
1259  .reg_value = sizeof ( hwd_register_t ),
1260  .reg_alloc = sizeof ( hwd_reg_alloc_t ),
1261  }
1262  ,
1263 
1264  /* function pointers in this component */
1265  .init_control_state = _aix_init_control_state,
1266  .start = _aix_start,
1267  .stop = _aix_stop,
1268  .read = _aix_read,
1269  .allocate_registers = _aix_allocate_registers,
1270  .update_control_state = _aix_update_control_state,
1271  .set_domain = _aix_set_domain,
1272  .reset = _aix_reset,
1273  .set_overflow = _aix_set_overflow,
1274 /* .stop_profiling = _aix_stop_profiling, */
1275  .ntv_enum_events = _aix_ntv_enum_events,
1276  .ntv_name_to_code = _aix_ntv_name_to_code,
1277  .ntv_code_to_name = _aix_ntv_code_to_name,
1278  .ntv_code_to_descr = _aix_ntv_code_to_descr,
1279  .ntv_code_to_bits = _aix_ntv_code_to_bits,
1280 
1281  .init_component = _aix_init_component,
1282  .ctl = _aix_ctl,
1283  .dispatch_timer = _aix_dispatch_timer,
1284  .init_thread = _aix_init_thread,
1285  .shutdown_thread = _aix_shutdown_thread,
1286 };
1287 
1290  .get_dmem_info = _aix_get_dmem_info,
1291  .get_real_usec = _aix_get_real_usec,
1292  .get_real_cycles = _aix_get_real_cycles,
1293  .get_virt_usec = _aix_get_virt_usec,
1294  .update_shlib_info = _aix_update_shlib_info,
1295  .get_system_info = _aix_get_system_info,
1296 };
char name[PAPI_HUGE_STR_LEN]
Definition: papi.h:691
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
#define START_OF_TEXT
Definition: aix.c:31
#define PAPI_HUGE_STR_LEN
Definition: fpapi.h:42
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
int available_granularities
Definition: papi.h:642
memset(eventId, 0, size)
#define PAPI_NATIVE_MASK
int val
Definition: libbif.c:235
static void copy_value(unsigned int val, char *nam, char *names, unsigned int *values, int len)
Definition: aix.c:146
_papi_int_inherit_t inherit
#define PAPI_ENOMEM
Definition: fpapi.h:107
#define PAPI_INT_MPX_DEF_US
Definition: papi_internal.h:65
volatile int lock_var[PAPI_MAX_LOCK]
Definition: aix.c:24
PPC64_native_map_t native_name_map[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:46
int _aix_ntv_name_to_code(char *name, unsigned int *evtcode)
Definition: aix.c:1196
#define PAPI_ENOIMPL
Definition: fpapi.h:124
papi_vector_t _aix_vector
Definition: aix.c:21
long long flags
Definition: iozone.c:12330
#define PAPI_DEF_ITIMER_NS
Definition: papi.h:453
#define papi_free(a)
Definition: papi_memory.h:35
caddr_t text_end
Definition: papi.h:693
static int do_counter_allocation(ppc64_reg_alloc_t *event_list, int size)
Definition: aix.c:160
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
start
Definition: iozone.c:22736
int default_granularity
Definition: papi.h:641
#define PAPI_ENOEVNT
Definition: fpapi.h:112
static void unset_config(hwd_control_state_t *ptr, int arg1)
Definition: aix.c:414
int ns
Definition: iozone.c:20358
long long tmp2
Definition: iozone.c:19604
int cpu_min_mhz
Definition: papi.h:792
static void _aix_lock_init(void)
Definition: aix.c:688
unsigned int counter_cmd[MAX_COUNTERS]
Definition: ppc64_events.h:52
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
static void set_config(hwd_control_state_t *ptr, int arg1, int arg2)
Definition: aix.c:408
#define MAX_GROUPS
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:275
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define MAX_MPX_COUNTERS
Definition: aix.h:45
caddr_t bss_start
Definition: papi.h:696
int _aix_init_thread(hwd_context_t *context)
Definition: aix.c:754
PAPI_exe_info_t exe_info
#define PAPI_DOM_OTHER
Definition: fpapi.h:23
Definition: perfctr-x86.h:133
void * _aix_get_overflow_address(void *context)
Definition: aix.c:954
fclose(thread_wqfd)
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
static int get_avail_hwcntr_bits(int cntr_avail_bits)
Definition: aix.c:766
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
hwd_pminfo_t pminfo
Definition: aix.c:43
static int set_default_domain(EventSetInfo_t *zero, int domain)
Definition: aix.c:510
int _aix_stop(hwd_context_t *ctx, hwd_control_state_t *cntrl)
Definition: aix.c:1024
double c
Definition: multiplex.c:22
int _aix_init_component(int cidx)
Definition: aix.c:702
int _aix_mdi_init()
Definition: aix.c:526
#define PAPI_INHERIT
Definition: papi.h:456
#define PAPI_ECNFLCT
Definition: fpapi.h:113
PAPI_shlib_info_t shlib_info
Return codes and api definitions.
#define PAPI_MAX_LOCK
Definition: papi_lock.h:18
char name[PAPI_MAX_STR_LEN]
_papi_int_itimer_t itimer
int _aix_get_memory_info(PAPI_hw_info_t *mem_info, int type)
Definition: aix-memory.c:16
struct client_command cc
Definition: iozone.c:21326
int ra_position
Definition: aix.h:98
hwd_groups_t group_map[MAX_GROUPS]
Definition: aix.c:47
t
Definition: iozone.c:23562
float mhz
Definition: papi.h:802
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
float revision
Definition: papi.h:786
char * description
Definition: perfctr-x86.h:136
long long _aix_get_virt_usec(void)
Definition: aix.c:673
int i
Definition: fileop.c:140
unsigned int selector
Definition: perfctr-x86.h:74
#define PAPI_ENOSUPP
Definition: fpapi.h:123
#define PAPI_NTV_GROUP_SHIFT
Definition: papi.h:523
int _aix_ntv_code_to_descr(unsigned int EventCode, char *ntv_descr, int len)
Definition: aix.c:330
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
char name[PAPI_MAX_STR_LEN]
Definition: perfctr-x86.h:135
#define PAPI_DOM_SUPERVISOR
Definition: fpapi.h:24
void dump_data(long long *vals)
Definition: aix.c:816
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
static int pid
struct utsname AixVer
Definition: aix.c:39
char *long long size
Definition: iozone.c:12023
int _aix_start(hwd_context_t *ctx, hwd_control_state_t *cntrl)
Definition: aix.c:967
pm_groups_info_t pmgroups
Definition: aix.c:44
static int cidx
Definition: event_info.c:40
caddr_t text_start
Definition: papi.h:692
#define hwd_context_t
int ra_counter_cmd[MAX_COUNTERS]
Definition: aix.h:100
PAPI_address_map_t address_info
Definition: papi.h:704
hwd_ucontext_t * ucontext
static int native
Definition: event_info.c:39
#define END_OF_BSS
Definition: aix.c:36
int _aix_shutdown_thread(hwd_context_t *ctx)
Definition: aix.c:696
get the executable&#39;s address space info
Definition: papi.h:690
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define PAPI_INT_ITIMER
Definition: papi_internal.h:54
#define END_OF_TEXT
Definition: aix.c:32
#define START_OF_DATA
Definition: aix.c:33
long long
Definition: iozone.c:19827
_papi_int_granularity_t granularity
int _aix_update_shlib_info(papi_mdi_t *mdi)
Definition: aix.c:1046
int _aix_read(hwd_context_t *ctx, hwd_control_state_t *spc, long long **vals, int flags)
Definition: aix.c:840
int _aix_ntv_enum_events(unsigned int *EventCode, int modifier)
Definition: aix.c:366
EventSetInfo_t * ESI
int nnodes
Definition: papi.h:780
int aix_ppc64_setup_native_table()
Definition: aix.c:106
void PAPIERROR(char *format,...)
void _aix_dispatch_timer(int signal, siginfo_t *si, void *i)
Definition: aix.c:931
#define PAPI_DOMAIN
Definition: fpapi.h:50
char version[PAPI_MAX_STR_LEN]
int _aix_ntv_code_to_name(unsigned int EventCode, char *ntv_name, int len)
Definition: aix.c:315
#define GROUP_INTS
child_stat flag
Definition: iozone.c:12951
int _papi_hwi_error_level
Definition: papi_internal.c:55
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:53
int _papi_load_preset_table(char *pmu_str, int pmu_type, int cidx)
Definition: papi_preset.c:299
pm_events_t hwd_pmevents_t
Definition: aix.h:82
int init_domain()
Definition: aix.c:420
#define PAPI_GRANUL
Definition: fpapi.h:52
_papi_int_multiplex_t multiplex
static void aix_ppc64_setup_gps(int total)
Definition: aix.c:68
NativeInfo_t * NativeInfoArray
#define PAPI_DEF_MPX_NS
Definition: fpapi.h:53
#define PAPI_INT_MPX_SIGNAL
Definition: papi_internal.h:52
atomic_p lock[]
Definition: aix.c:25
int _aix_init_control_state(hwd_control_state_t *ptr)
Definition: aix.c:254
#define PAPI_ESYS
Definition: fpapi.h:108
int threshold
#define PAPI_QUIET
Definition: fpapi.h:38
int(* set_domain)(hwd_control_state_t *, int)
Definition: papi_vector.h:42
char vendor_string[PAPI_MAX_STR_LEN]
Definition: papi.h:783
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
strcpy(filename, default_filename)
PAPI_hw_info_t hw_info
pm_info_t hwd_pminfo_t
Definition: aix.h:81
int(* get_system_info)(papi_mdi_t *mdi)
Definition: papi_vector.h:68
caddr_t data_start
Definition: papi.h:694
static char * trim_string(char *in)
Definition: aix.c:289
unsigned int ra_group[GROUP_INTS]
Definition: aix.h:99
int _aix_set_granularity(hwd_control_state_t *this_state, int domain)
Definition: aix.c:486
static int maxgroups
Definition: aix.c:38
int _aix_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
Definition: aix.c:874
int vendor
Definition: papi.h:782
struct sigcontext hwd_ucontext_t
Definition: aix-context.h:10
static int set_inherit(int arg)
Definition: perfmon.c:724
static int round_requested_ns(int ns)
Definition: aix.c:863
int _papi_hwi_init_os(void)
Definition: aix.c:1213
#define PAPI_DEF_ITIMER
Definition: papi.h:452
int model
Definition: papi.h:784
#define PAPI_NTV_GROUP_AND_MASK
Definition: papi.h:522
char * name
Definition: iozone.c:23648
static int total
Definition: rapl_overflow.c:5
PAPI_address_map_t * map
Definition: papi.h:709
int _aix_get_dmem_info(PAPI_dmem_info_t *d)
Definition: aix-memory.c:64
int cpu_max_mhz
Definition: papi.h:791
caddr_t bss_end
Definition: papi.h:697
#define ISLEVEL(a)
Definition: papi_debug.h:54
#define PAPI_EBUF
Definition: fpapi.h:125
#define PAPI_NATIVE_AND_MASK
caddr_t data_end
Definition: papi.h:695
#define PAPI_MAX_NATIVE_EVENTS
int totalcpus
Definition: papi.h:781
_papi_int_domain_t domain
int _aix_allocate_registers(EventSetInfo_t *ESI)
Definition: aix.c:201
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:785
hwd_siginfo_t * si
char fullname[PAPI_HUGE_STR_LEN]
Definition: papi.h:703
static int set_default_granularity(EventSetInfo_t *zero, int granularity)
Definition: aix.c:517
#define PAPI_DOM_USER
Definition: fpapi.h:21
int _papi_hwi_dispatch_overflow_signal(void *papiContext, caddr_t address, int *isHardware, long long overflow_bit, int genOverflowBit, ThreadInfo_t **t, int cidx)
Definition: extras.c:214
X86_register_t resources
Definition: perfctr-x86.h:137
#define END_OF_DATA
Definition: aix.c:34
int _aix_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
Definition: aix.c:348
return
Definition: iozone.c:22170
long long _aix_get_real_cycles(void)
Definition: aix.c:666
hwd_control_state_t * ctl_state
static int _aix_get_system_info(papi_mdi_t *mdi)
Definition: aix.c:560
long j
Definition: iozone.c:19135
#define START_OF_BSS
Definition: aix.c:35
static int _aix_set_domain(hwd_control_state_t *this_state, int domain)
Definition: aix.c:436
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
long long tmp
Definition: iozone.c:12031
int(* get_memory_info)(PAPI_hw_info_t *, int)
Definition: papi_vector.h:69
int _aix_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *context)
Definition: aix.c:273
#define GET_OVERFLOW_ADDRESS(ctx)
Definition: aix-context.h:12
int _aix_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
Definition: aix.c:946
long long _aix_get_real_usec(void)
Definition: aix.c:654
const char * names[NUM_EVENTS]
static void set_hwcntr_codes(int selector, unsigned char *from, int *to)
Definition: aix.c:780
#define hwd_register_t
int _aix_reset(hwd_context_t *ESI, hwd_control_state_t *zero)
Definition: aix.c:827
#define PM_INIT_FLAGS
Definition: aix.h:75
#define PAPI_GRN_THR
Definition: fpapi.h:67
void dump_cmd(pm_prog_t *t)
Definition: aix.c:795
signal(SIGINT, signal_handler)
papi_cpc_event_t counter_cmd
Definition: solaris-ultra.h:61
void aix_initialize_native_table()
Definition: aix.c:51
rewind(w_traj_fd)
#define papi_calloc(a, b)
Definition: papi_memory.h:37
#define POWER_MAX_COUNTERS
Definition: aix.h:43
#define DEBUG_SUBSTRATE
Definition: papi_debug.h:27
int ncpu
Definition: papi.h:776
char * ptr
Definition: iozone.c:23586