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

Go to the source code of this file.

Macros

#define PERFCTR_CPU_NAME   perfctr_cpu_name
 
#define PERFCTR_CPU_NRCTRS   perfctr_cpu_nrctrs
 

Functions

static void clear_unused_pmcsel_bits (hwd_control_state_t *cntrl)
 
static int set_domain (hwd_control_state_t *cntrl, unsigned int domain)
 
void print_control (const struct perfctr_cpu_control *control)
 
int setup_ppc64_presets (int cputype)
 
int _papi_hwd_init_control_state (hwd_control_state_t *ptr)
 
static int do_counter_allocation (ppc64_reg_alloc_t *event_list, int size)
 
int _papi_hwd_allocate_registers (EventSetInfo_t *ESI)
 
int _papi_hwd_update_control_state (hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *context)
 
int _papi_hwd_start (hwd_context_t *ctx, hwd_control_state_t *state)
 
int _papi_hwd_stop (hwd_context_t *ctx, hwd_control_state_t *state)
 
int _papi_hwd_read (hwd_context_t *ctx, hwd_control_state_t *spc, long long **dp, int flags)
 
int _papi_hwd_reset (hwd_context_t *ctx, hwd_control_state_t *cntrl)
 
int _papi_hwd_shutdown (hwd_context_t *ctx)
 
static void swap_events (EventSetInfo_t *ESI, struct hwd_pmc_control *contr, int cntr1, int cntr2)
 
int _papi_hwd_set_overflow (EventSetInfo_t *ESI, int EventIndex, int threshold)
 
int _papi_hwd_set_profile (EventSetInfo_t *ESI, int EventIndex, int threshold)
 
int _papi_hwd_stop_profiling (ThreadInfo_t *master, EventSetInfo_t *ESI)
 
int _papi_hwd_set_domain (hwd_control_state_t *cntrl, int domain)
 
char * _papi_hwd_ntv_code_to_name (unsigned int EventCode)
 
int _papi_hwd_ntv_code_to_bits (unsigned int EventCode, hwd_register_t *bits)
 
static void copy_value (unsigned int val, char *nam, char *names, unsigned int *values, int len)
 
char * _papi_hwd_ntv_code_to_descr (unsigned int EventCode)
 
int _papi_hwd_ntv_enum_events (unsigned int *EventCode, int modifier)
 
int ppc64_setup_vector_table (papi_vectors_t *vtable)
 

Variables

static hwi_search_t preset_name_map_PPC64 [PAPI_MAX_PRESET_EVENTS]
 
hwi_search_tpreset_search_map
 
unsigned long long pmc_sel_mask [NUM_COUNTER_MASKS]
 
papi_mdi_t _papi_hwi_system_info
 
papi_svector_t _ppc64_vector_table []
 

Macro Definition Documentation

#define PERFCTR_CPU_NAME   perfctr_cpu_name

Definition at line 24 of file perfctr-ppc64.c.

#define PERFCTR_CPU_NRCTRS   perfctr_cpu_nrctrs

Definition at line 25 of file perfctr-ppc64.c.

Function Documentation

int _papi_hwd_allocate_registers ( EventSetInfo_t ESI)

Definition at line 327 of file perfctr-ppc64.c.

328 {
329  hwd_control_state_t *this_state = &ESI->machdep;
330  int i, j, natNum, index;
331  ppc64_reg_alloc_t event_list[MAX_COUNTERS];
332  int group;
333 
334  /* not yet successfully mapped, but have enough slots for events */
335 
336  /* Initialize the local structure needed
337  for counter allocation and optimization. */
338  natNum = ESI->NativeCount;
339  for ( i = 0; i < natNum; i++ ) {
340  event_list[i].ra_position = -1;
341  for ( j = 0; j < MAX_COUNTERS; j++ ) {
342  if ( ( index =
344  ni_event & PAPI_NATIVE_AND_MASK].index ) <
345  0 )
346  return PAPI_ECNFLCT;
347  event_list[i].ra_counter_cmd[j] =
349  }
350  for ( j = 0; j < GROUP_INTS; j++ ) {
351  if ( ( index =
353  ni_event & PAPI_NATIVE_AND_MASK].index ) <
354  0 )
355  return PAPI_ECNFLCT;
356  event_list[i].ra_group[j] = native_table[index].resources.group[j];
357  }
358  }
359  if ( ( group = do_counter_allocation( event_list, natNum ) ) >= 0 ) { /* successfully mapped */
360  /* copy counter allocations info back into NativeInfoArray */
361  this_state->group_id = group;
362  for ( i = 0; i < natNum; i++ ) {
363 // ESI->NativeInfoArray[i].ni_position = event_list[i].ra_position;
364  this_state->control.cpu_control.pmc_map[i] =
365  event_list[i].ra_position;
366  ESI->NativeInfoArray[i].ni_position = i;
367  }
368  /* update the control structure based on the NativeInfoArray */
369  SUBDBG( "Group ID: %d\n", group );
370 
371  return PAPI_OK;
372  } else {
373  return PAPI_ECNFLCT;
374  }
375 }
PPC64_native_map_t native_name_map[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:46
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_ECNFLCT
Definition: fpapi.h:113
int ra_position
Definition: aix.h:98
int i
Definition: fileop.c:140
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
int ra_counter_cmd[MAX_COUNTERS]
Definition: aix.h:100
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define GROUP_INTS
NativeInfo_t * NativeInfoArray
static int do_counter_allocation(ppc64_reg_alloc_t *event_list, int size)
unsigned int ra_group[GROUP_INTS]
Definition: aix.h:99
#define PAPI_NATIVE_AND_MASK
X86_register_t resources
Definition: perfctr-x86.h:137
long j
Definition: iozone.c:19135

Here is the call graph for this function:

int _papi_hwd_init_control_state ( hwd_control_state_t ptr)

Definition at line 261 of file perfctr-ppc64.c.

262 {
263  int i = 0;
264  for ( i = 0; i < _papi_hwi_system_info.sub_info.num_cntrs; i++ ) {
265  ptr->control.cpu_control.pmc_map[i] = i;
266  }
267  ptr->control.cpu_control.tsc_on = 1;
268  set_domain( ptr, _papi_hwi_system_info.sub_info.default_domain );
269  return ( PAPI_OK );
270 }
return PAPI_OK
Definition: linux-nvml.c:458
int i
Definition: fileop.c:140
static int set_domain(hwd_control_state_t *cntrl, unsigned int domain)
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57

Here is the call graph for this function:

int _papi_hwd_ntv_code_to_bits ( unsigned int  EventCode,
hwd_register_t bits 
)

Definition at line 651 of file perfctr-ppc64.c.

652 {
653  if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
654  _papi_hwi_system_info.sub_info.num_native_events ) {
655  return ( PAPI_ENOEVNT );
656  }
657 
658  memcpy( bits,
659  &native_table[native_name_map[EventCode & PAPI_NATIVE_AND_MASK].
660  index].resources, sizeof ( hwd_register_t ) );
661  return ( PAPI_OK );
662 }
PPC64_native_map_t native_name_map[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:46
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
#define PAPI_NATIVE_AND_MASK
char* _papi_hwd_ntv_code_to_descr ( unsigned int  EventCode)

Definition at line 675 of file perfctr-ppc64.c.

676 {
677  if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
678  _papi_hwi_system_info.sub_info.num_native_events ) {
679  return "\0";
680  }
681  return ( native_table
682  [native_name_map[EventCode & PAPI_NATIVE_AND_MASK].index].
683  description );
684 }
PPC64_native_map_t native_name_map[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:46
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
#define PAPI_NATIVE_AND_MASK
char* _papi_hwd_ntv_code_to_name ( unsigned int  EventCode)

Definition at line 642 of file perfctr-ppc64.c.

643 {
644  if ( ( EventCode & PAPI_NATIVE_AND_MASK ) >=
645  _papi_hwi_system_info.sub_info.num_native_events )
646  return ( '\0' ); // return a null string for invalid events
647  return ( native_name_map[EventCode & PAPI_NATIVE_AND_MASK].name );
648 }
PPC64_native_map_t native_name_map[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:46
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
char * name
Definition: iozone.c:23648
#define PAPI_NATIVE_AND_MASK
int _papi_hwd_ntv_enum_events ( unsigned int EventCode,
int  modifier 
)

Definition at line 687 of file perfctr-ppc64.c.

688 {
689  if ( modifier == PAPI_ENUM_EVENTS ) {
690  int index = *EventCode & PAPI_NATIVE_AND_MASK;
691  if ( index + 1 == MAX_NATNAME_MAP_INDEX ) {
692  return ( PAPI_ENOEVNT );
693  } else {
694  *EventCode = *EventCode + 1;
695  return ( PAPI_OK );
696  }
697  } else if ( modifier == PAPI_PWR4_ENUM_GROUPS ) {
698 /* Use this modifier for all supported PPC64 processors. */
699  unsigned int group = ( *EventCode & 0x00FF0000 ) >> 16;
700  int index = *EventCode & 0x000001FF;
701  int i;
702  unsigned int tmpg;
703 
704  *EventCode = *EventCode & 0xFF00FFFF;
705  for ( i = 0; i < GROUP_INTS; i++ ) {
706  tmpg = native_table[index].resources.group[i];
707  if ( group != 0 ) {
708  while ( ( ffs( tmpg ) + i * 32 ) <= group && tmpg != 0 )
709  tmpg = tmpg ^ ( 1 << ( ffs( tmpg ) - 1 ) );
710  }
711  if ( tmpg != 0 ) {
712  group = ffs( tmpg ) + i * 32;
713  *EventCode = *EventCode | ( group << 16 );
714  return ( PAPI_OK );
715  }
716  }
717  if ( index + 1 == MAX_NATNAME_MAP_INDEX ) {
718  return ( PAPI_ENOEVNT );
719  }
720  *EventCode = *EventCode + 1;
721  return ( PAPI_OK );
722  } else
723  return ( PAPI_EINVAL );
724 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
int i
Definition: fileop.c:140
native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS]
Definition: aix.c:41
#define GROUP_INTS
#define MAX_NATNAME_MAP_INDEX
#define PAPI_NATIVE_AND_MASK
X86_register_t resources
Definition: perfctr-x86.h:137
int _papi_hwd_read ( hwd_context_t ctx,
hwd_control_state_t spc,
long long **  dp,
int  flags 
)

Definition at line 452 of file perfctr-ppc64.c.

454 {
455  if ( flags & PAPI_PAUSED ) {
456  vperfctr_read_state( ctx->perfctr, &spc->state, NULL );
457  } else {
458  SUBDBG( "vperfctr_read_ctrs\n" );
459  if ( spc->rvperfctr != NULL ) {
460  rvperfctr_read_ctrs( spc->rvperfctr, &spc->state );
461  } else {
462  vperfctr_read_ctrs( ctx->perfctr, &spc->state );
463  }
464  }
465 
466  *dp = ( long long * ) spc->state.pmc;
467 #ifdef DEBUG
468  {
469  if ( ISLEVEL( DEBUG_SUBSTRATE ) ) {
470  int i;
471  for ( i = 0;
472  i <
473  spc->control.cpu_control.nractrs +
474  spc->control.cpu_control.nrictrs; i++ ) {
475  SUBDBG( "raw val hardware index %d is %lld\n", i,
476  ( long long ) spc->state.pmc[i] );
477  }
478  }
479  }
480 #endif
481  return ( PAPI_OK );
482 }
long long flags
Definition: iozone.c:12330
#define PAPI_PAUSED
Definition: fpapi.h:31
return PAPI_OK
Definition: linux-nvml.c:458
int i
Definition: fileop.c:140
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define ISLEVEL(a)
Definition: papi_debug.h:54
if(gettimeofday(&tp,(struct timezone *) NULL)==-1) perror("gettimeofday")
#define DEBUG_SUBSTRATE
Definition: papi_debug.h:27

Here is the call graph for this function:

int _papi_hwd_reset ( hwd_context_t ctx,
hwd_control_state_t cntrl 
)

Definition at line 486 of file perfctr-ppc64.c.

487 {
488  return ( _papi_hwd_start( ctx, cntrl ) );
489 }
int _papi_hwd_start(hwd_context_t *ctx, hwd_control_state_t *state)

Here is the call graph for this function:

int _papi_hwd_set_domain ( hwd_control_state_t cntrl,
int  domain 
)

Definition at line 635 of file perfctr-ppc64.c.

636 {
637  return set_domain( cntrl, domain );
638 }
static int set_domain(hwd_control_state_t *cntrl, unsigned int domain)

Here is the call graph for this function:

int _papi_hwd_set_overflow ( EventSetInfo_t ESI,
int  EventIndex,
int  threshold 
)

Definition at line 549 of file perfctr-ppc64.c.

550 {
551  hwd_control_state_t *this_state = &ESI->machdep;
552  struct hwd_pmc_control *contr = &this_state->control;
553  int i, ncntrs, nricntrs = 0, nracntrs = 0, retval = 0;
554 
555  OVFDBG( "EventIndex=%d, threshold = %d\n", EventIndex, threshold );
556 
557  /* The correct event to overflow is EventIndex */
558  ncntrs = _papi_hwi_system_info.sub_info.num_cntrs;
559  i = ESI->EventInfoArray[EventIndex].pos[0];
560  if ( i >= ncntrs ) {
561  OVFDBG( "Selector id (%d) larger than ncntrs (%d)\n", i, ncntrs );
562  return PAPI_EINVAL;
563  }
564  if ( threshold != 0 ) { /* Set an overflow threshold */
565  if ( ESI->EventInfoArray[EventIndex].derived ) {
566  OVFDBG( "Can't overflow on a derived event.\n" );
567  return PAPI_EINVAL;
568  }
569 
570  if ( ( retval =
572  hardware_intr_sig,
573  NEED_CONTEXT ) ) != PAPI_OK )
574  return ( retval );
575 
576  contr->cpu_control.ireset[i] = PMC_OVFL - threshold;
577  nricntrs = ++contr->cpu_control.nrictrs;
578  nracntrs = --contr->cpu_control.nractrs;
579  contr->si_signo = _papi_hwi_system_info.sub_info.hardware_intr_sig;
580  contr->cpu_control.ppc64.mmcr0 |= PERF_INT_ENABLE;
581 
582  /* move this event to the bottom part of the list if needed */
583  if ( i < nracntrs )
584  swap_events( ESI, contr, i, nracntrs );
585 
586  OVFDBG( "Modified event set\n" );
587  } else {
588  if ( contr->cpu_control.ppc64.mmcr0 & PERF_INT_ENABLE ) {
589  contr->cpu_control.ireset[i] = 0;
590  nricntrs = --contr->cpu_control.nrictrs;
591  nracntrs = ++contr->cpu_control.nractrs;
592  if ( !nricntrs )
593  contr->cpu_control.ppc64.mmcr0 &= ( ~PERF_INT_ENABLE );
594  }
595  /* move this event to the top part of the list if needed */
596  if ( i >= nracntrs )
597  swap_events( ESI, contr, i, nracntrs - 1 );
598  if ( !nricntrs )
599  contr->si_signo = 0;
600 
601  OVFDBG( "Modified event set\n" );
602 
603  retval =
605  hardware_intr_sig );
606  }
607 #ifdef DEBUG
608  print_control( &contr->cpu_control );
609 #endif
610  OVFDBG( "%s:%d: Hardware overflow is still experimental.\n", __FILE__,
611  __LINE__ );
612  OVFDBG( "End of call. Exit code: %d\n", retval );
613 
614  return ( retval );
615 }
#define hwd_pmc_control
Definition: perfctr-x86.h:11
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
int i
Definition: fileop.c:140
#define OVFDBG(format, args...)
Definition: papi_debug.h:68
#define PMC_OVFL
Definition: perfctr-ppc64.h:55
int _papi_hwi_start_signal(int signal, int need_context, int cidx)
Definition: extras.c:401
int _papi_hwi_stop_signal(int signal)
Definition: extras.c:441
EventInfo_t * EventInfoArray
int threshold
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:57
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
#define PERF_INT_ENABLE
Definition: perfctr-x86.h:53
#define NEED_CONTEXT
Definition: papi_internal.h:97
static void swap_events(EventSetInfo_t *ESI, struct hwd_pmc_control *contr, int cntr1, int cntr2)
void print_control(const struct perfctr_cpu_control *control)
Definition: perfctr-x86.c:96
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int _papi_hwd_set_profile ( EventSetInfo_t ESI,
int  EventIndex,
int  threshold 
)

Definition at line 620 of file perfctr-ppc64.c.

621 {
622  /* This function is not used and shouldn't be called. */
623  return PAPI_ECMP;
624 }
#define PAPI_ECMP
Definition: fpapi.h:109
int _papi_hwd_shutdown ( hwd_context_t ctx)

Definition at line 495 of file perfctr-ppc64.c.

496 {
497  int retval = vperfctr_unlink( ctx->perfctr );
498  SUBDBG( "_papi_hwd_shutdown vperfctr_unlink(%p) = %d\n", ctx->perfctr,
499  retval );
500  vperfctr_close( ctx->perfctr );
501  SUBDBG( "_papi_hwd_shutdown vperfctr_close(%p)\n", ctx->perfctr );
502  memset( ctx, 0x0, sizeof ( hwd_context_t ) );
503 
504  if ( retval )
505  return ( PAPI_ESYS );
506  return ( PAPI_OK );
507 }
memset(eventId, 0, size)
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define PAPI_ESYS
Definition: fpapi.h:108
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int _papi_hwd_start ( hwd_context_t ctx,
hwd_control_state_t state 
)

Definition at line 410 of file perfctr-ppc64.c.

411 {
412  int error;
413 /* clear_unused_pmcsel_bits(this_state); moved to update_control_state */
414 #ifdef DEBUG
415  print_control( &state->control.cpu_control );
416 #endif
417  if ( state->rvperfctr != NULL ) {
418  if ( ( error =
419  rvperfctr_control( state->rvperfctr, &state->control ) ) < 0 ) {
420  SUBDBG( "rvperfctr_control returns: %d\n", error );
422  return ( PAPI_ESYS );
423  }
424  return ( PAPI_OK );
425  }
426  if ( ( error = vperfctr_control( ctx->perfctr, &state->control ) ) < 0 ) {
427  SUBDBG( "vperfctr_control returns: %d\n", error );
429  return ( PAPI_ESYS );
430  }
431  return ( PAPI_OK );
432 }
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)
#define PAPI_ESYS
Definition: fpapi.h:108
#define RCNTRL_ERROR
Definition: perfctr-x86.h:66
void print_control(const struct perfctr_cpu_control *control)
Definition: perfctr-x86.c:96
#define VCNTRL_ERROR
Definition: perfctr-x86.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwd_stop ( hwd_context_t ctx,
hwd_control_state_t state 
)

Definition at line 435 of file perfctr-ppc64.c.

436 {
437  if ( state->rvperfctr != NULL ) {
438  if ( rvperfctr_stop( ( struct rvperfctr * ) ctx->perfctr ) < 0 ) {
440  return ( PAPI_ESYS );
441  }
442  return ( PAPI_OK );
443  }
444  if ( vperfctr_stop( ctx->perfctr ) < 0 ) {
446  return ( PAPI_ESYS );
447  }
448  return ( PAPI_OK );
449 }
return PAPI_OK
Definition: linux-nvml.c:458
void PAPIERROR(char *format,...)
#define PAPI_ESYS
Definition: fpapi.h:108
#define RCNTRL_ERROR
Definition: perfctr-x86.h:66
#define VCNTRL_ERROR
Definition: perfctr-x86.h:65

Here is the call graph for this function:

int _papi_hwd_stop_profiling ( ThreadInfo_t master,
EventSetInfo_t ESI 
)

Definition at line 628 of file perfctr-ppc64.c.

629 {
630  ESI->profile.overflowcount = 0;
631  return PAPI_OK;
632 }
return PAPI_OK
Definition: linux-nvml.c:458
EventSetProfileInfo_t profile
int _papi_hwd_update_control_state ( hwd_control_state_t this_state,
NativeInfo_t native,
int  count,
hwd_context_t context 
)

Definition at line 381 of file perfctr-ppc64.c.

384 {
385 
386 
387  this_state->control.cpu_control.nractrs =
388  count - this_state->control.cpu_control.nrictrs;
389  // save control state
390  unsigned int save_mmcr0_ctlbits =
391  PERF_CONTROL_MASK & this_state->control.cpu_control.ppc64.mmcr0;
392 
393  this_state->control.cpu_control.ppc64.mmcr0 =
394  group_map[this_state->group_id].mmcr0 | save_mmcr0_ctlbits;
395 
396  unsigned long long mmcr1 =
397  ( ( unsigned long long ) group_map[this_state->group_id].mmcr1U ) << 32;
398  mmcr1 += group_map[this_state->group_id].mmcr1L;
399  this_state->control.cpu_control.ppc64.mmcr1 = mmcr1;
400 
401  this_state->control.cpu_control.ppc64.mmcra =
402  group_map[this_state->group_id].mmcra;
403 
404  clear_unused_pmcsel_bits( this_state );
405  return PAPI_OK;
406 }
#define PERF_CONTROL_MASK
Definition: perfctr-ppc64.h:59
static void clear_unused_pmcsel_bits(hwd_control_state_t *cntrl)
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
hwd_groups_t group_map[MAX_GROUPS]
Definition: aix.c:47
long long
Definition: iozone.c:19827

Here is the call graph for this function:

static void clear_unused_pmcsel_bits ( hwd_control_state_t cntrl)
static

Definition at line 147 of file perfctr-ppc64.c.

148 {
149  struct perfctr_cpu_control *cpu_ctl = &cntrl->control.cpu_control;
150  int i;
151  int num_used_counters = cpu_ctl->nractrs + cpu_ctl->nrictrs;
152  unsigned int used_counters = 0x0;
153  for ( i = 0; i < num_used_counters; i++ ) {
154  used_counters |= 1 << cpu_ctl->pmc_map[i];
155  }
156 #if defined(_POWER5) || defined(_POWER5p)
157  int freeze_pmc5_pmc6 = 0; /* for Power5 use only */
158 #endif
159 
160  for ( i = 0; i < MAX_COUNTERS; i++ ) {
161  unsigned int active_counter = ( ( 1 << i ) & used_counters );
162  if ( !active_counter ) {
163 #if defined(_POWER5) || defined(_POWER5p)
164  if ( i > 3 )
165  freeze_pmc5_pmc6++;
166  else
167  cpu_ctl->ppc64.mmcr1 &= pmc_sel_mask[i];
168 #else
169  if ( i < 2 ) {
170  cpu_ctl->ppc64.mmcr0 &= pmc_sel_mask[i];
171  } else {
172  cpu_ctl->ppc64.mmcr1 &= pmc_sel_mask[i];
173  if ( i == ( MAX_COUNTERS - 1 ) )
174  cpu_ctl->ppc64.mmcra &= pmc_sel_mask[NUM_COUNTER_MASKS - 1];
175  }
176 #endif
177  }
178  }
179 #if defined(_POWER5) || defined(_POWER5p)
180  if ( freeze_pmc5_pmc6 == 2 )
181  cpu_ctl->ppc64.mmcr0 |= PMC5_PMC6_FREEZE;
182 #endif
183 }
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
#define NUM_COUNTER_MASKS
Definition: perfctr-ppc64.h:29
int i
Definition: fileop.c:140
unsigned long long pmc_sel_mask[NUM_COUNTER_MASKS]

Here is the caller graph for this function:

static void copy_value ( unsigned int  val,
char *  nam,
char *  names,
unsigned int values,
int  len 
)
static

Definition at line 665 of file perfctr-ppc64.c.

667 {
668  *values = val;
669  strncpy( names, nam, len );
670  names[len - 1] = 0;
671 }
int val
Definition: libbif.c:235
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
const char * names[NUM_EVENTS]
static int do_counter_allocation ( ppc64_reg_alloc_t event_list,
int  size 
)
static

Definition at line 288 of file perfctr-ppc64.c.

289 {
290  int i, j, group = -1;
291  unsigned int map[GROUP_INTS];
292 
293  for ( i = 0; i < GROUP_INTS; i++ ) {
294  map[i] = event_list[0].ra_group[i];
295  }
296 
297  for ( i = 1; i < size; i++ ) {
298  for ( j = 0; j < GROUP_INTS; j++ )
299  map[j] &= event_list[i].ra_group[j];
300  }
301 
302  for ( i = 0; i < GROUP_INTS; i++ ) {
303  if ( map[i] ) {
304  group = ffs( map[i] ) - 1 + i * 32;
305  break;
306  }
307  }
308 
309  if ( group < 0 )
310  return group; /* allocation fail */
311  else {
312  for ( i = 0; i < size; i++ ) {
313  for ( j = 0; j < MAX_COUNTERS; j++ ) {
314  if ( event_list[i].ra_counter_cmd[j] >= 0
315  && event_list[i].ra_counter_cmd[j] ==
316  group_map[group].counter_cmd[j] )
317  event_list[i].ra_position = j;
318  }
319  }
320  return group;
321  }
322 }
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
int ra_position
Definition: aix.h:98
hwd_groups_t group_map[MAX_GROUPS]
Definition: aix.c:47
int i
Definition: fileop.c:140
char *long long size
Definition: iozone.c:12023
#define GROUP_INTS
unsigned int ra_group[GROUP_INTS]
Definition: aix.h:99
long j
Definition: iozone.c:19135

Here is the caller graph for this function:

int ppc64_setup_vector_table ( papi_vectors_t *  vtable)

Definition at line 754 of file perfctr-ppc64.c.

755 {
756  int retval = PAPI_OK;
757  retval = _papi_hwi_setup_vector_table( vtable, _ppc64_vector_table );
758 }
return PAPI_OK
Definition: linux-nvml.c:458
papi_svector_t _ppc64_vector_table[]
ssize_t retval
Definition: libasync.c:338
void print_control ( const struct perfctr_cpu_control *  control)

Definition at line 226 of file perfctr-ppc64.c.

227 {
228  unsigned int i;
229 
230  SUBDBG( "Control used:\n" );
231  SUBDBG( "tsc_on\t\t\t%u\n", control->tsc_on );
232  SUBDBG( "nractrs\t\t\t%u\n", control->nractrs );
233  SUBDBG( "nrictrs\t\t\t%u\n", control->nrictrs );
234  SUBDBG( "mmcr0\t\t\t0x%X\n", control->ppc64.mmcr0 );
235  SUBDBG( "mmcr1\t\t\t0x%llX\n",
236  ( unsigned long long ) control->ppc64.mmcr1 );
237  SUBDBG( "mmcra\t\t\t0x%X\n", control->ppc64.mmcra );
238 
239  for ( i = 0; i < ( control->nractrs + control->nrictrs ); ++i ) {
240  SUBDBG( "pmc_map[%u]\t\t%u\n", i, control->pmc_map[i] );
241  if ( control->ireset[i] ) {
242  SUBDBG( "ireset[%d]\t%X\n", i, control->ireset[i] );
243  }
244  }
245 
246 }
int i
Definition: fileop.c:140
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int set_domain ( hwd_control_state_t cntrl,
unsigned int  domain 
)
static

Definition at line 185 of file perfctr-ppc64.c.

186 {
187  int did = 0;
188 
189  /* A bit setting of '0' indicates "count this context".
190  * Start off by turning off counting for all contexts;
191  * then, selectively re-enable.
192  */
193  cntrl->control.cpu_control.ppc64.mmcr0 |=
195  if ( domain & PAPI_DOM_USER ) {
196  cntrl->control.cpu_control.ppc64.mmcr0 |= PERF_USER;
197  cntrl->control.cpu_control.ppc64.mmcr0 ^= PERF_USER;
198  did = 1;
199  }
200  if ( domain & PAPI_DOM_KERNEL ) {
201  cntrl->control.cpu_control.ppc64.mmcr0 |= PERF_KERNEL;
202  cntrl->control.cpu_control.ppc64.mmcr0 ^= PERF_KERNEL;
203  did = 1;
204  }
205  if ( domain & PAPI_DOM_SUPERVISOR ) {
206  cntrl->control.cpu_control.ppc64.mmcr0 |= PERF_HYPERVISOR;
207  cntrl->control.cpu_control.ppc64.mmcr0 ^= PERF_HYPERVISOR;
208  did = 1;
209  }
210 
211  if ( did ) {
212  return ( PAPI_OK );
213  } else {
214  return ( PAPI_EINVAL );
215  }
216 
217 }
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_DOM_SUPERVISOR
Definition: fpapi.h:24
#define PERF_KERNEL
Definition: perfctr-ppc64.h:56
#define PERF_USER
Definition: perfctr-ppc64.h:57
#define PAPI_DOM_USER
Definition: fpapi.h:21
#define PERF_HYPERVISOR
Definition: perfctr-ppc64.h:58

Here is the caller graph for this function:

int setup_ppc64_presets ( int  cputype)

Definition at line 253 of file perfctr-ppc64.c.

254 {
257 }
int _papi_hwi_setup_all_presets(hwi_search_t *findem, int cidx)
Definition: papi_preset.c:37
hwi_search_t * preset_search_map
static hwi_search_t preset_name_map_PPC64[PAPI_MAX_PRESET_EVENTS]
Definition: perfctr-ppc64.c:28

Here is the call graph for this function:

Here is the caller graph for this function:

static void swap_events ( EventSetInfo_t ESI,
struct hwd_pmc_control contr,
int  cntr1,
int  cntr2 
)
static

Definition at line 518 of file perfctr-ppc64.c.

520 {
521  unsigned int ui;
522  int si, i, j;
523 
524  for ( i = 0; i < ESI->NativeCount; i++ ) {
525  if ( ESI->NativeInfoArray[i].ni_position == cntr1 )
526  ESI->NativeInfoArray[i].ni_position = cntr2;
527  else if ( ESI->NativeInfoArray[i].ni_position == cntr2 )
528  ESI->NativeInfoArray[i].ni_position = cntr1;
529  }
530  for ( i = 0; i < ESI->NumberOfEvents; i++ ) {
531  for ( j = 0; ESI->EventInfoArray[i].pos[j] >= 0; j++ ) {
532  if ( ESI->EventInfoArray[i].pos[j] == cntr1 )
533  ESI->EventInfoArray[i].pos[j] = cntr2;
534  else if ( ESI->EventInfoArray[i].pos[j] == cntr2 )
535  ESI->EventInfoArray[i].pos[j] = cntr1;
536  }
537  }
538  ui = contr->cpu_control.pmc_map[cntr1];
539  contr->cpu_control.pmc_map[cntr1] = contr->cpu_control.pmc_map[cntr2];
540  contr->cpu_control.pmc_map[cntr2] = ui;
541 
542  si = contr->cpu_control.ireset[cntr1];
543  contr->cpu_control.ireset[cntr1] = contr->cpu_control.ireset[cntr2];
544  contr->cpu_control.ireset[cntr2] = si;
545 }
int i
Definition: fileop.c:140
NativeInfo_t * NativeInfoArray
EventInfo_t * EventInfoArray
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
long j
Definition: iozone.c:19135

Here is the caller graph for this function:

Variable Documentation

papi_mdi_t _papi_hwi_system_info

Definition at line 57 of file papi_internal.c.

papi_svector_t _ppc64_vector_table[]
Initial value:
= {
VEC_PAPI_HWD_INIT_CONTROL_STATE},
VEC_PAPI_HWD_ALLOCATE_REGISTERS},
VEC_PAPI_HWD_UPDATE_CONTROL_STATE},
{( void ( * )( ) ) _papi_hwd_start, VEC_PAPI_HWD_START},
{( void ( * )( ) ) _papi_hwd_stop, VEC_PAPI_HWD_STOP},
{( void ( * )( ) ) _papi_hwd_read, VEC_PAPI_HWD_READ},
{( void ( * )( ) ) _papi_hwd_reset, VEC_PAPI_HWD_RESET},
{( void ( * )( ) ) _papi_hwd_shutdown, VEC_PAPI_HWD_SHUTDOWN},
{( void ( * )( ) ) _papi_hwd_set_overflow, VEC_PAPI_HWD_SET_OVERFLOW},
{( void ( * )( ) ) _papi_hwd_set_profile, VEC_PAPI_HWD_SET_PROFILE},
{( void ( * )( ) ) _papi_hwd_stop_profiling, VEC_PAPI_HWD_STOP_PROFILING},
{( void ( * )( ) ) _papi_hwd_set_domain, VEC_PAPI_HWD_SET_DOMAIN},
VEC_PAPI_HWD_NTV_CODE_TO_NAME},
VEC_PAPI_HWD_NTV_CODE_TO_BITS},
VEC_PAPI_HWD_NTV_CODE_TO_DESCR},
VEC_PAPI_HWD_NTV_ENUM_EVENTS},
{NULL, VEC_PAPI_END}
}
int _papi_hwd_ntv_enum_events(unsigned int *EventCode, int modifier)
int _papi_hwd_read(hwd_context_t *ctx, hwd_control_state_t *spc, long long **dp, int flags)
int _papi_hwd_shutdown(hwd_context_t *ctx)
void
Definition: iozone.c:18627
char * _papi_hwd_ntv_code_to_name(unsigned int EventCode)
int _papi_hwd_reset(hwd_context_t *ctx, hwd_control_state_t *cntrl)
int _papi_hwd_allocate_registers(EventSetInfo_t *ESI)
int _papi_hwd_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
char * _papi_hwd_ntv_code_to_descr(unsigned int EventCode)
int _papi_hwd_start(hwd_context_t *ctx, hwd_control_state_t *state)
int _papi_hwd_set_domain(hwd_control_state_t *cntrl, int domain)
int _papi_hwd_init_control_state(hwd_control_state_t *ptr)
int _papi_hwd_set_profile(EventSetInfo_t *ESI, int EventIndex, int threshold)
int _papi_hwd_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *context)
int _papi_hwd_stop(hwd_context_t *ctx, hwd_control_state_t *state)
int _papi_hwd_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
int _papi_hwd_stop_profiling(ThreadInfo_t *master, EventSetInfo_t *ESI)

Definition at line 726 of file perfctr-ppc64.c.

unsigned long long pmc_sel_mask[NUM_COUNTER_MASKS]
Initial value:
= {
}
#define PMC8_SEL_MASK
Definition: perfctr-ppc64.h:38
#define PMC8a_SEL_MASK
Definition: perfctr-ppc64.h:39
#define PMC7_SEL_MASK
Definition: perfctr-ppc64.h:37
#define PMC6_SEL_MASK
Definition: perfctr-ppc64.h:36
#define PMC3_SEL_MASK
Definition: perfctr-ppc64.h:33
#define PMC1_SEL_MASK
Definition: perfctr-ppc64.h:31
#define PMC4_SEL_MASK
Definition: perfctr-ppc64.h:34
#define PMC5_SEL_MASK
Definition: perfctr-ppc64.h:35
#define PMC2_SEL_MASK
Definition: perfctr-ppc64.h:32

Definition at line 133 of file perfctr-ppc64.c.

hwi_search_t preset_name_map_PPC64[PAPI_MAX_PRESET_EVENTS]
static

Definition at line 28 of file perfctr-ppc64.c.

hwi_search_t* preset_search_map

Definition at line 123 of file perfctr-ppc64.c.